Posted by Ivαn Sαnchez Ortega on 01/24/06 23:02
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
paladin.rithe@gmail.com wrote:
> Is it possible to store classes in an array? I am fairly new to PHP,
> and haven't found anything either way yet.
Classes? No. Objects? Definively yes.
> "Cannot use a scalar value as an array", and "Call to a member function
> on a non-object". The second is related to the first, as I'm calling a
> function on the array value.
My guess is that you are doing something like:
<?php
$object = new foo;
$array[$object] = $counter;
?>
When you should be doing:
<?php
$object = new foo;
$array[$counter] = $object;
?>
- --
- ----------------------------------
IvΓ‘n SΓ‘nchez Ortega -i-punto-sanchez--arroba-mirame-punto-net
http://acm.asoc.fi.upm.es/~mr/ ; http://acm.asoc.fi.upm.es/~ivan/
MSN:i_eat_s_p_a_m_for_breakfast@hotmail.com
Jabber:ivansanchez@jabber.org ; ivansanchez@kdetalk.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
iD8DBQFD1pX33jcQ2mg3Pc8RAmsNAJwKqNtfSPj0kZ6T0eBFucdaywxohQCfQ/Wk
SAaNzt8xfdIQCzOlG6zK4LA=
=kW+r
-----END PGP SIGNATURE-----
[Back to original message]
|