This question already has answers here:
PHP multidimensional array search by value (23 answers)
Closed 3 days ago.
This is my array:
array(2) {
[0]=>
array(2) {
["label"]=>
string(1) "1234"
["value"]=>
string(0) "Bosch"
}
[1]=>
array(2) {
["value"]=>
string(4) "8348"
["label"]=>
string(6) "Makita"
}
}
Now, I want to search for Makita
and get 8348
as a result. How would I do that?
1条答案
按热度按时间a8jjtwal1#
您可以使用array_search函数执行此操作