FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » ArrayObject - copy or reference
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: ArrayObject - copy or reference [message #175150 is a reply to message #175050] Tue, 16 August 2011 22:03 Go to previous messageGo to previous message
Jo Schulze is currently offline  Jo Schulze
Messages: 15
Registered: January 2011
Karma:
Junior Member
Thomas Mlynarczyk wrote:

> Please consider the following example code:
>
> $array = array( 1, 2, 3 );
> $obj = new ArrayObject( $array );
> $obj[0] = 42;
> echo $array[0];
>
> With PHP 5.2.0 this prints 42, with PHP 5.2.4 however, I get 1 (as
> expected). I have searched both on PHP's changelog [1] and Google, but
> could not find any information about this issue. I assume it is a bug
> that was fixed, but which one and in which version?

With PHP5.3.7rc this prints 42 which I would expect. The line
$obj[0] = 42;
overwites the value with hash key 0

I see no bug here.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Freelance PHP Developer
Next Topic: How to integrate paypal payment Indian currency support ..?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Nov 25 03:38:44 GMT 2024

Total time taken to generate the page: 0.04689 seconds