|
Posted by Colin Fine on 10/17/06 23:24
tatsudoshi wrote:
> ----- Original Message -----
> From: "Colin Fine" <news@kindness.demon.co.uk>
> Newsgroups: comp.lang.php
> Sent: Monday, October 16, 2006 11:48 PM
> Subject: Re: Class variable problem
>
>
>> You'll need to be more explicit about what you're expecting to see, and
>> what you are seeing.
>>
>> I thought it might be a problem with references (in PHP5 Objects are
>> copied by references, but arrays are not) but I can't see a place where
>> you're assigning to a copied array, so it doesn't appear to be that.
>>
>> Colin
>
>
(top-posting corrected)
> I am not using references at all, as I have not been able to figure
out how
> it works in the different versions of PHP.
>
No, I can see you aren't, and as far as I can see there is nowhere in
the code you posted where you should be.
If you had anything like
$row = $this->array[$index]
and then
$row[] = 2;
then you would need to make $row a reference otherwise the assignment to
a member of row would be to a copy and not to the original in $this->array.
This is true in both PHP4 and PHP5; but if the contents of
$this->array[$index] were itself an object (rather than an array), then
you would need to use a reference in PHP4, but not in PHP5.
You still haven't told us, AFAICS, precisely what result you are getting
and how it differs from what you expect.
Colin
Navigation:
[Reply to this message]
|