note 117507 added to function.array-splice
| From: | guillaume dot lacourt at gmail dot com | Date: | Sat, 20 Jun 2015 13:30:57 +0000 |
| Subject: | note 117507 added to function.array-splice | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202913@lists.php.net to get a copy of this message | ||
Using array_splice when you traverse array with internal pointer's function reset the array,
eg:
<?php
end($arrOfData);
$last = key($arrOfData);
reset($arrOfData);
while (($data = current($arrOfData))) {
if ($last === key($arrOfData)) {
array_splice($arrOfData, $last, 1);
// current($arrOfData) => first value of $arrOfData
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 82.233.56.39
----
Manual Page -- http://php.net/manual/en/function.array-splice.php
Edit -- https://master.php.net/note/edit/117507
Del: integrated -- https://master.php.net/note/delete/117507/integrated
Del: useless -- https://master.php.net/note/delete/117507/useless
Del: bad code -- https://master.php.net/note/delete/117507/bad+code
Del: spam -- https://master.php.net/note/delete/117507/spam
Del: non-english -- https://master.php.net/note/delete/117507/non-english
Del: in docs -- https://master.php.net/note/delete/117507/in+docs
Del: other reasons-- https://master.php.net/note/delete/117507
Reject -- https://master.php.net/note/reject/117507
Search -- https://master.php.net/manage/user-notes.php