note 45776 deleted from function.array-slice by cmb
| From: | cmb@php.net | Date: | Sun, 29 Dec 2019 12:32:32 +0000 |
| Subject: | note 45776 deleted from function.array-slice by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-213709@lists.php.net to get a copy of this message | ||
Note Submitter: pies at sputnik dot pl
----
My shot at Dams's array_slice_key() implementation:
function array_slice_key($array, $offset, $len=-1){
if (!is_array($array))
return FALSE;
$length = $len >= 0? $len: count($array);
$keys = array_slice(array_keys($array), $offset, $length);
foreach($keys as $key) {
$return[$key] = $array[$key];
}
return $return;
}