NYCPHP Meetup

NYPHP.org

[nycphp-talk] Trouble with Array of Objects

Malcolm, Gary gmalcolm at professionalcredit.com
Tue May 27 16:52:00 EDT 2003


hmm, w/o the code...

is this like you code:

	myarray[]=new thingamajig;
or
	$bob = new thingamajig;
	myarray[$index] = $bob;
or
	myarray['bob'] = new thingamajig;

> -----Original Message-----
> From: Christopher R. Merlo [mailto:cmerlo at turing.matcmp.ncc.edu]
> Sent: Tuesday, 27 May, 2003 1: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/ ---
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20030527/80503993/attachment.html>


More information about the talk mailing list