note 16306 deleted from function.list by tomsommer

From: Date: Tue, 31 Aug 2004 23:44:10 +0000
Subject: note 16306 deleted from function.list by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75788@lists.php.net to get a copy of this message
Note Submitter: pgl at instinct dot org ---- If you use list() to assign to an array with the same name as the array being assigned from, the array with overwrite the values in the source array. eg: <? $a = array('a', 'b'); list($a[0], $a['x']) = $a; print_r($a); ?> gives: Array ( [0] => a [1] => b [x] => b ) if you try and use list to assign to an array, using an array which is the return value of the target array, it doesn't work. eg: <? $a = 'a:b'; list($a['x'], $a['y']) = explode(':', $a); print_r($a); ?> gives: a:b this is true for any function that returns an array, including user defined arrays.

« previous php.notes (#75788) next »