note 101450 added to function.array-pop
| From: | mtroy dot student at gmail dot com | Date: | Fri, 17 Dec 2010 02:39:24 +0000 |
| Subject: | note 101450 added to function.array-pop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175012@lists.php.net to get a copy of this message | ||
to apply arra_pop serveral times but not recursive
function array_mpop($array, $iterate)
{
if(!is_array($array) && is_int($iterate))
return false;
while(($iterate--)!=false)
array_pop($array);
return $array;
}
for test :
$a = array("titi", "toto", "tata", "tonton",
"toutou", "tutu");
$a = array_mpop($a, 2);
var_dump($a);
result :
array(4) { [0]=> string(4) "titi" [1]=> string(4) "toto" [2]=>
string(4) "tata" [3]=> string(6) "tonton" }
----
Server IP: 69.147.83.197
Probable Submitter: 88.181.139.29
----
Manual Page -- http://www.php.net/manual/en/function.array-pop.php
Edit -- https://master.php.net/note/edit/101450
Del: integrated -- https://master.php.net/note/delete/101450/integrated
Del: useless -- https://master.php.net/note/delete/101450/useless
Del: bad code -- https://master.php.net/note/delete/101450/bad+code
Del: spam -- https://master.php.net/note/delete/101450/spam
Del: non-english -- https://master.php.net/note/delete/101450/non-english
Del: in docs -- https://master.php.net/note/delete/101450/in+docs
Del: other reasons-- https://master.php.net/note/delete/101450
Reject -- https://master.php.net/note/reject/101450
Search -- https://master.php.net/manage/user-notes.php