note 123525 deleted from function.array-search by crell
| From: | crell@php.net | Date: | Thu, 31 Mar 2022 20:41:30 +0000 |
| Subject: | note 123525 deleted from function.array-search by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217958@lists.php.net to get a copy of this message | ||
Note Submitter: pvv at renam dot md
----
About searcing in multi-dimentional arrays;
note on "xfoxawy at gmail dot com" and turabgarip at gmail dot com;
$xx = array_column($array, 'NAME', 'ID');
will produce an array like :
$xx = [
[ID_val] => NAME_val
[ID_val] => NAME_val
]
so:
$yy = array_search('tesxt', array_column($array, 'NAME', 'ID'));
will output expected ID;