note 31234 modified in function.array-splice by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 14:49:52 +0000 |
| Subject: | note 31234 modified in function.array-splice by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79785@lists.php.net to get a copy of this message | ||
key-safe:
<?php
function array_kslice ($array, $offset, $length = 0) {
$k = array_slice (array_keys ($array), $offset, $length);
$v = array_slice (array_values ($array), $offset, $length);
for ($i = 0; $i < count ($k); $i ++) $r[$k[$i]] = $v[$i];
return $r;
}
?>
smth like this. hope you like it more than versions above :)
--was--
key-safe:
function array_kslice ($array, $offset, $length = 0) {
$k = array_slice (array_keys ($array), $offset, $length);
$v = array_slice (array_values ($array), $offset, $length);
for ($i = 0; $i < count ($k); $i ++) $r[$k[$i]] = $v[$i];
return $r;
}
smth like this. hope you like it more than versions above :)
http://php.net/manual/en/function.array-splice.php