note 108115 added to function.array-slice

From: Date: Thu, 29 Mar 2012 20:53:54 +0000
Subject: note 108115 added to function.array-slice
Groups: php.notes 
Request: Send a blank email to php-notes+get-186905@lists.php.net to get a copy of this message
This might be obvious to other people but it took me a long time to figure it out; $length takes precedence over $preserve_keys An example: <?php $array = array(1, 2, 3, 4, 5); $slice = array_slice($array, 3); print_r($slice); //This will return array(4, 5) //However $slice = array($array, 3, True); //This will return array(4) //The reason for this, is it's read like $array=$array, $offset=3, $length=True ?> ---- Server IP: 69.147.83.197 Probable Submitter: 71.93.88.74 ---- Manual Page -- http://www.php.net/manual/en/function.array-slice.php Edit -- https://master.php.net/note/edit/108115 Del: integrated -- https://master.php.net/note/delete/108115/integrated Del: useless -- https://master.php.net/note/delete/108115/useless Del: bad code -- https://master.php.net/note/delete/108115/bad+code Del: spam -- https://master.php.net/note/delete/108115/spam Del: non-english -- https://master.php.net/note/delete/108115/non-english Del: in docs -- https://master.php.net/note/delete/108115/in+docs Del: other reasons-- https://master.php.net/note/delete/108115 Reject -- https://master.php.net/note/reject/108115 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#186905) next »