note 81462 added to function.array-splice

From: Date: Fri, 29 Feb 2008 09:04:11 +0000
Subject: note 81462 added to function.array-splice
Groups: php.notes 
Request: Send a blank email to php-notes+get-136583@lists.php.net to get a copy of this message
array_splice($input, -1) / array_slice($input, 1) equivalent to array_shift($input) ????? Try this: $input = array('key1' => array('deep1' => 'Value'), 'key2' => array('deep2' => 'Value'), 'key3' => array('deep3' => 'Value')); $foo_splice = array_splice($input, -1); $foo_shift = array_shift($input); echo "<pre>".print_r($foo_splice, true)."</pre>"; echo "<pre>".print_r($foo_shift, true)."</pre>"; Output: Array ( [key3] => Array ( [deep3] => Value ) ) Array ( [deep1] => Value ) ---- Server IP: 217.160.72.57 Probable Submitter: 217.7.56.90 ---- Manual Page -- http://www.php.net/manual/en/function.array-splice.php Edit -- https://master.php.net/note/edit/81462 Del: integrated -- https://master.php.net/note/delete/81462/integrated Del: useless -- https://master.php.net/note/delete/81462/useless Del: bad code -- https://master.php.net/note/delete/81462/bad+code Del: spam -- https://master.php.net/note/delete/81462/spam Del: non-english -- https://master.php.net/note/delete/81462/non-english Del: in docs -- https://master.php.net/note/delete/81462/in+docs Del: other reasons-- https://master.php.net/note/delete/81462 Reject -- https://master.php.net/note/reject/81462 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#136583) next »