note 81462 deleted from function.array-splice by googleguy

From: Date: Tue, 22 Oct 2013 08:01:27 +0000
Subject: note 81462 deleted from function.array-splice by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196734@lists.php.net to get a copy of this message
Note Submitter: nash0r ---- array_splice($input, -1) / array_slice($input, 1) equivalent to array_shift($input) ????? Try this: <?php $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 )

« previous php.notes (#196734) next »