RE: [PHP] oop thingie

From: Date: Fri, 20 Jul 2001 11:31:52 +0000
Subject: RE: [PHP] oop thingie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58878@lists.php.net to get a copy of this message
Not sure about your code, but what you describe is perfectly faesible in PHP. If you are setting values in one part of your code and cannot see these values in another part of your code then I would suggest that you have reference problem somewhere. The code you provided looks fine, maybe the problem is elsewhere. Alternatively you are looking in th ewrong place. You say that pets->dog->lostpets is always empty, yet your code seems to suggest that pets->dog is an array of objects, in which case you should be looking at pets->dog[n]->lostpets rather than pets->dog->lostpets. -----Original Message----- From: Jon Yaggie [mailto:dmsales@design-monster.com] Sent: 20 July 2001 12:15 To: php-general@lists.php.net Subject: [PHP] oop thingie ok first of all i admit i am complete new to OOP. Secondly didnt write this script. but there is my problem i declare a class say dog. dog uses a constructor that has a few extra unassigned arrays. laster i declare a new instance of dog in another class (pets) i invoke the constructor and all is well with a few empty arrays as part of my object. but how can i put information in these arrays? can i do it through pet? for example can i make a member function in pet that goes soemthing like this - function wekkcount($id, $newpets) { $i=0; while($newpets[$i]) { $this->dog[$id]->lostpets[$i] = $newpets[$i]; $i++; } where this refers to class pets and dog is an instance of dog? i have been trying to all day and even though i know for sure $newpets has information in it. i always have an empty array in pets->dog->lostpets. i am starting to believe maybe i just cant do it. or maybe there is soemthing stupid i am missing? Thank You, Jon Yaggie www.design-monster.com And they were singing . . . '100 little bugs in the code 100 bugs in the code fix one bug, compile it again 101 little bugs in the code 101 little bugs in the code . . .' And it continued until they reached 0

« previous php.general (#58878) next »