Re: Class var not retaining values
| From: | Markus Fischer | Date: | Mon, 21 May 2001 22:52:05 +0000 |
| Subject: | Re: Class var not retaining values | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-53788@lists.php.net to get a copy of this message | ||
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 < $index; $i++)
> {
> $out = $this->reasons[$i];
> echo "$out...";
> }
> $index++;
> return $score;
> }
Put in a
var_dump( $this->reasons);
to view yourself what it really contains.
Or maybe you called your method static instead of a method ?
- Markus