note 95158 added to arrayobject.exchangearray

From: Date: Tue, 15 Dec 2009 22:11:24 +0000
Subject: note 95158 added to arrayobject.exchangearray
Groups: php.notes 
Request: Send a blank email to php-notes+get-164029@lists.php.net to get a copy of this message
It seems that input array is always passed by reference. For example if you have an existing array $array with some values then you have an arrayobject $o and then you do this: $o->exchangeArray($array); $o->offsetSet('somekey', 'some value'); Now if you check your $array array, it will have a key 'somekey' with value of 'some value' I totally did not expect that, I am sure it was a mistake to pass array by reference by default. ---- Server IP: 64.71.164.2 Probable Submitter: 75.97.204.207 ---- Manual Page -- http://www.php.net/manual/en/arrayobject.exchangearray.php Edit -- https://master.php.net/note/edit/95158 Del: integrated -- https://master.php.net/note/delete/95158/integrated Del: useless -- https://master.php.net/note/delete/95158/useless Del: bad code -- https://master.php.net/note/delete/95158/bad+code Del: spam -- https://master.php.net/note/delete/95158/spam Del: non-english -- https://master.php.net/note/delete/95158/non-english Del: in docs -- https://master.php.net/note/delete/95158/in+docs Del: other reasons-- https://master.php.net/note/delete/95158 Reject -- https://master.php.net/note/reject/95158 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#164029) next »