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..
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 =
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
Is the class variable declared as an array?
class test{
var $reasons = array();
function addReason( $score, $reason, $id ) {
$reasons[ $index ] = "$score|$reason|$id";
}
}
Hope this helps,
-C
""Bob"" <[EMAIL PROTECTED]> wrote in message
9ec2rm$etg$[EMAIL PROTECTED]">n
4 matches
Mail list logo