NYCPHP Meetup

NYPHP.org

[nycphp-talk] Trouble with Array of Objects

Bhulipongsanon, Pinyo Pinyo.Bhulipongsanon at usa.xerox.com
Tue May 27 16:50:50 EDT 2003


for ( $i = 0 ; $i <= 4 ; $i++ ) {
  $myArray[$i] = codeToCreateObject();
}

I am not sure if this will help?  Can I see your code?


-----Original Message-----
From: Christopher R. Merlo [mailto:cmerlo at turing.matcmp.ncc.edu]
Sent: Tuesday, May 27, 2003 4:46 PM
To: NYPHP Talk
Subject: [nycphp-talk] Trouble with Array of Objects


Folks:
This is probably easy, but it doesn't seem to work the way it does in
Java or C++.

I want to create five objects within a loop, and add them to an array.

Everything I try seems to place one object in the last (occasionally
the first) element of the array, but I never get the whole array
filled.  sizeof( $myArray ) continually returns 1.

However, I know the objects are getting created, because I have placed
a call to the "print yourself" function inside the constructor, so I
know five objects are getting created.

What am I doing wrong?
-c

-- 
cmerlo at turing.matcmp.ncc.edu        http://turing.matcmp.ncc.edu/~cmerlo

We're sorry, but the number you have dialed is imaginary.  Please
rotate your phone ninety degrees and try again.  Thank you.


--- Unsubscribe at http://nyphp.org/list/ ---




More information about the talk mailing list