note 73914 added to function.array-slice
| From: | bc at bnc-automatisering dot nl | Date: | Thu, 15 Mar 2007 11:41:38 +0000 |
| Subject: | note 73914 added to function.array-slice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124478@lists.php.net to get a copy of this message | ||
first at all, ur php version check does not work correctly.
version 4.3.10 (4310 > 520)
Second, $a is not initialized.
Third, to let the function work the same as slice (offset) it should be:
function narray_slice($array, $offset, $length){
$a = 0;
foreach ($array as $key => $value) {
if (($a >= $offset) && ($a - $offset < $length))
$output_array[$key] = $value;
$a++;
}
return $output_array;
}
----
Server IP: 83.137.20.120
Probable Submitter: 213.197.49.68
----
Manual Page -- http://www.php.net/manual/en/function.array-slice.php
Edit -- https://master.php.net/note/edit/73914
Del: integrated -- https://master.php.net/note/delete/73914/integrated
Del: useless -- https://master.php.net/note/delete/73914/useless
Del: bad code -- https://master.php.net/note/delete/73914/bad+code
Del: spam -- https://master.php.net/note/delete/73914/spam
Del: non-english -- https://master.php.net/note/delete/73914/non-english
Del: in docs -- https://master.php.net/note/delete/73914/in+docs
Del: other reasons-- https://master.php.net/note/delete/73914
Reject -- https://master.php.net/note/reject/73914
Search -- https://master.php.net/manage/user-notes.php