note 91319 added to function.array-pop
| From: | daniel dot muhlradatuvcmsdotcom at osu1 dot php dot net | Date: | Fri, 05 Jun 2009 15:48:34 +0000 |
| Subject: | note 91319 added to function.array-pop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-156396@lists.php.net to get a copy of this message | ||
Two nice functions.
1) Remove a row in array giving the value. The result will have a sequential key.
<?php
function array_remove_by_value($arr,$value) {
return array_values(array_diff($arr,array($value)));
}
?>
2) Remove a row in array giving the key. The result will have a sequential key.
<?php
function array_remove_by_key($arr,$key) {
return array_values(array_diff_key($arr,array($key)));
}
?>
----
Server IP: 201.216.232.3
Probable Submitter: 200.49.157.166
----
Manual Page -- http://www.php.net/manual/en/function.array-pop.php
Edit -- https://master.php.net/note/edit/91319
Del: integrated -- https://master.php.net/note/delete/91319/integrated
Del: useless -- https://master.php.net/note/delete/91319/useless
Del: bad code -- https://master.php.net/note/delete/91319/bad+code
Del: spam -- https://master.php.net/note/delete/91319/spam
Del: non-english -- https://master.php.net/note/delete/91319/non-english
Del: in docs -- https://master.php.net/note/delete/91319/in+docs
Del: other reasons-- https://master.php.net/note/delete/91319
Reject -- https://master.php.net/note/reject/91319
Search -- https://master.php.net/manage/user-notes.php