note 111730 added to function.array-filter
| From: | Anonymous | Date: | Thu, 21 Mar 2013 22:42:43 +0000 |
| Subject: | note 111730 added to function.array-filter | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-194166@lists.php.net to get a copy of this message | ||
If you're looking to filter an associative array to leave out certain keys, this is not the
function to do it.
/*
* Simple example illustrating how to filter an associative array so as to exclude certain keys in
the resulting array
*/
$array1 = array( 'a' => 1, 'b' => 2, 'c' => 3 );
// let's strip out the keys 'c' and 'b'
var_dump(
array_diff_key( $array1, array_flip( array( 'b', 'c' ) ) )
);
----
Server IP: 69.147.83.199
Probable Submitter: 70.55.240.92
----
Manual Page -- http://php.net/manual/en/function.array-filter.php
Edit -- https://master.php.net/note/edit/111730
Del: integrated -- https://master.php.net/note/delete/111730/integrated
Del: useless -- https://master.php.net/note/delete/111730/useless
Del: bad code -- https://master.php.net/note/delete/111730/bad+code
Del: spam -- https://master.php.net/note/delete/111730/spam
Del: non-english -- https://master.php.net/note/delete/111730/non-english
Del: in docs -- https://master.php.net/note/delete/111730/in+docs
Del: other reasons-- https://master.php.net/note/delete/111730
Reject -- https://master.php.net/note/reject/111730
Search -- https://master.php.net/manage/user-notes.php