Re: oop thingie

From: Date: Fri, 20 Jul 2001 11:39:08 +0000
Subject: Re: oop thingie
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-58881@lists.php.net to get a copy of this message
okay sorry i didnt clarify what i meant by empty. meant when i do a var_dump() on it i get an empty array. i have searched most of the day but in actuality it is rather straight forward. $newpets() from user input. and when i print it it is just fine but immediately after i call this fuction pets->dog->weekcount($newpets); so i guess if the array prints find just before the function yet it still shows an empty array i am baffle where else the problem could be the rest of the code doesnt really even come near these values or function 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 ----- Original Message ----- From: "Neil Kimber" <neil.kimber@flytxt.com> To: "Jon Yaggie" <dmsales@design-monster.com>; <php-general@lists.php.net> Sent: Friday, July 20, 2001 6:31 PM Subject: RE: [PHP] oop thingie > 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 (#58881) next »