note 108115 deleted from function.array-slice by googleguy

From: Date: Fri, 27 Jul 2012 16:41:41 +0000
Subject: note 108115 deleted from function.array-slice by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-189433@lists.php.net to get a copy of this message
Note Submitter: masta dot hacks at gmail dot com ---- 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 ?>

« previous php.notes (#189433) next »