Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #2870
| From | Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: ArrayObject - copy or reference |
| Date | 2011-08-18 13:48 +0200 |
| Organization | albasani.net |
| Message-ID | <j2iu7p$9hs$1@news.albasani.net> (permalink) |
| References | <j1p6c2$nk2$1@news.albasani.net> <4e4ae91c$0$6579$9b4e6d93@newsspool3.arcor-online.net> |
Jo Schulze schrieb: >> $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 > With PHP5.3.7rc this prints 42 which I would expect. No it doesn't. I just installed PHP 5.3.7RC5 to test it. It prints 1. > The line > $obj[0] = 42; > overwites the value with hash key 0 It overwrites the value with hash key 0 in *$obj*. But it should not modify *$array*. > I see no bug here. There has definitely been a change in behaviour somewhere between 5.2.0 and 5.2.4. And that should be documented somewhere. Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche)
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ArrayObject - copy or reference Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2011-08-08 19:28 +0200
Re: ArrayObject - copy or reference Jo Schulze <antispam@feuersee.de> - 2011-08-17 00:03 +0200
Re: ArrayObject - copy or reference Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2011-08-18 13:48 +0200
Re: ArrayObject - copy or reference Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-18 13:54 -0400
Re: ArrayObject - copy or reference Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2011-08-18 20:44 +0200
Re: ArrayObject - copy or reference Jerry Stuckle <jstucklex@attglobal.net> - 2011-08-18 19:26 -0400
csiph-web