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:[EMAIL PROTECTED]]
Sent: 20 July 2001 12:15
To: [EMAIL PROTECTED]
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




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to