On Mon, Sep 02, 2002 at 10:06:50PM +0800, Terrence Cox wrote : > Knowing that I can't create actual structures in PHP, I recently realized I could do >something like this. > > <?php > function create_Struct($struct_array) > { > $struct_array=array( > conn => 0, > host => "", > u_name => "", > pass => "", > db => "" > ); > return $struct_array; > } > > $db_struct = create_Struct($db_struct); > $db_pointer = &$db_struct; > print_r($db_pointer); > ?> > > What I'm curious about is the possibility of making > something like this "built in", for lack of a better term. I've heard a number of C >guys asking about this on some message boards and came up with this as a result. > > Is there a better way? What do you guys think?
Not really. Some also missuse objects for that purpose. heck, I remember asking this question first when I came to PHP years ago :) I got stuck to use arrays at first. Later and never needed this anymore (stopped coding PHP like C) and mainly used real objects etc. -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc "Finally, if someone actually flying a plane is relying on a freakin' webcam to land, we're all in trouble." - A /. poster. -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php