note 45273 deleted from function.list by tomsommer

From: Date: Tue, 31 Aug 2004 23:42:37 +0000
Subject: note 45273 deleted from function.list by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75783@lists.php.net to get a copy of this message
Note Submitter: webmaster at my-x-perience dot de ---- As pgl at instinct dot org said it will not work when you use something like this <?php $a = "a:b"; list($a['x'],$a['y']) = explode(":",$a); ?> so I tried using a temporary variable to store the data <?php $a = "a:b"; $temp = explode(":",$a); list($a['x'],$a['y']) = $temp; print_r($a); // will output a:b ?> it seems that list() does not overwrite existing variables if they are not the type array you don't get the expected result unless you unset the original variable <?php $a = "a:b"; $temp = explode(":",$a); unset($a); list($a['x'],$a['y']) = $temp; print_r($a); // will output Array( [y] => b [x] => a) ?>

« previous php.notes (#75783) next »