""JJeffman"" <[EMAIL PROTECTED]> wrote in message
000701c09ba2$3b2bb020$f0d4d7c8@jjeffman">news:000701c09ba2$3b2bb020$f0d4d7c8@jjeffman...
> I've already made an object which had a property that was an array. Now I
> need to have an array that can hold objects as its elements is It possible
?
> I didn't get it the expression array[$i]->Object gave me syntax error. Any
> tips ?

$object1 = new someClass;
$object2 = new someClass;

$array = array();

$array[] = $object1;
$array[] = $object2;

The $array now contains copies of the two objects.

You can fill more in like this:

$array[] = new someClass;

Access the objects like this:

$array[0]->someMethod();

/Christian



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to