Re: [PHP] Class var not retaining values

2001-05-21 Thread Markus Fischer
On Mon, May 21, 2001 at 05:58:06PM -0400, Bob wrote : I have a class defined with a var $reasons that I will use as an array. The code to add to it is: function AddReason($score, $reason, $id) { static $index = 0; $this-reasons[$index] = $score|$reason|$id; for ($i = 0; $i

Re: [PHP] Class var not retaining values

2001-05-21 Thread Peter Dudley
Could it be that you need your for loop to iterate = instead of ? As it is, I don't think it will ever show anything. After all, you are setting $index to 0 at the beginning of the function every time you call it. My guess is you actually want to keep track of $index as an instance variable