note 21012 modified in function.array-slice by tularis

From: Date: Wed, 01 Sep 2004 09:07:44 +0000
Subject: note 21012 modified in function.array-slice by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75824@lists.php.net to get a copy of this message
[Editor's Note: It is easier to do the same thing using array_values() ] array_slice() can be used to "re-index" an array to start from key 0. For example, unpack creates an array with keys starting from 1; <?php var_dump(unpack("C*","AB")); ?> produces <?php array(2) { [1]=> int(65) [2]=> int(66) } ?> and <?php var_dump(array_slice(unpack("C*","AB"),0)); ?> give you <?php array(2) { [0]=> int(65) [1]=> int(66) } ?> --was-- array_slice() can be used to "re-index" an array to start from key 0. For example, unpack creates an array with keys starting from 1; <?php var_dump(unpack("C*","AB")); ?> produces <?php array(2) { [1]=> int(65) [2]=> int(66) } ?> and <?php var_dump(array_slice(unpack("C*","AB"),0)); ?> give you <?php array(2) { [0]=> int(65) [1]=> int(66) } ?> http://php.net/manual/en/function.array-slice.php

« previous php.notes (#75824) next »