In php 5.5.5 & later versions, you can try this

$array_subjected_to_search =array(
array(
        'name' => 'flash',
        'type' => 'hero'
    ),

array(
        'name' => 'zoom',
        'type' => 'villian'
    ),

array(
        'name' => 'snart',
        'type' => 'antihero'
    )
);
$key = array_search('snart', array_column($array_subjected_to_search, 'name'));
var_dump($array_subjected_to_search[$key]);

Output:

array(2) { ["name"]=> string(5) "snart" ["type"]=> string(8) "antihero" }

working sample : http://sandbox.onlinephpfunctions.com/code/19385da11fe0614ef5f84f58b6dae80bd216fc01

Documentation about array_column can be found here

Answer from SRB on Stack Overflow
🌐
Medium
medium.com › @rodgersj097 › how-to-search-a-multi-dimensional-array-in-php-with-internal-functions-2d08a5eb4363
How to search a multi-dimensional array in PHP with internal functions. | by Jacob Rodgers | Medium
October 1, 2020 - array_search(0235, array_column($2dArray, 'Vin')) PHP · Multidimensional · Arrays · 1 follower · ·1 following · Help · Status · About · Careers · Press · Blog · Privacy · Rules ·
Discussions

How to search in this multidimensional array by using PHP?
Find answers to How to search in this multidimensional array by using PHP? from the expert community at Experts Exchange More on experts-exchange.com
🌐 experts-exchange.com
January 6, 2018
Best way to do array_search on multi-dimensional array? - PHP - SitePoint Forums | Web Development & Design Community
So, somehow, I provide “hello” and it returns array(‘key1’, ‘key2’, ‘key3’); - that would be ideal. ... There are a lot of user comments in the PHP docs that can help you with questions such as this, see the below link. More on sitepoint.com
🌐 sitepoint.com
0
May 23, 2012
php - Get the first level key of the first row containing a specified column value in a 2d array - Stack Overflow
Also, in my situation there may be multiple keys to return as a result of searching by other fields that may not be unique. /** * @param array multidimensional * @param string value to search for, ie a specific field name like name_first * @param string associative key to find it in, ie field_name ... More on stackoverflow.com
🌐 stackoverflow.com
how to use php array_search to match 2 key value in multi dimensional array - Stack Overflow
I have a multi dimensional array and i want to use php array_search to find the key for where 2 key values match. below is my array. $array[] = [ 'id' => 2, 'title' => 'p... More on stackoverflow.com
🌐 stackoverflow.com
🌐
PHP
php.net › manual › en › function.array-search.php
PHP: array_search - Manual
The searched value. ... If needle is a string, the comparison is done in a case-sensitive manner. ... If the third parameter strict is set to true then the array_search() function will search for identical elements in the haystack.
🌐
GeeksforGeeks
geeksforgeeks.org › php › php-multidimensional-array-search-by-value
PHP multidimensional array search by value - GeeksforGeeks
July 11, 2025 - In PHP, multidimensional array search refers to searching a value in a multilevel nested array. There are various techniques to carry out this type of search, such as iterating over nested arrays, recursive approaches and inbuilt array search ...
🌐
Nabilhassen
nabilhassen.com › php-search-multidimensional-array
Searching in a multidimensional array in PHP
October 15, 2025 - array_search() returns the first matching key or false if not found; use the third ($strict) parameter to force === comparison. When you need to search by multiple criteria or across multiple levels, a simple loop gives full control.
🌐
Experts Exchange
experts-exchange.com › questions › 29076910 › How-to-search-in-this-multidimensional-array-by-using-PHP.html
Solved: How to search in this multidimensional array by using PHP? | Experts Exchange
January 6, 2018 - array_column($arr, 'slug')); $key = array_search('Sons of Anarchy', array_column($arr, 'title')); $record = $arr[$key]; ... I guess something else is necessary... Generates this error: Could you check? ... EARN REWARDS FOR ASKING, ANSWERING, AND MORE. Earn free swag for participating on the platform. ... <?php $jsonstring = '....'; // very long $arr = json_decode($jsonstring, true); $slug = $arr['slug']; $title = $arr['title']; //OK it's printed // print_r($slug); // print_r($title); // Search a film $cont=0; foreach ($arr as $key ) { if ($arr['title'] === 'Suits of Woe') { // How to obtain all the other features of the film....
🌐
GitHub
gist.github.com › raazon › b39d782e4908b6bf5f359c96ff7b8839
PHP multidimensional array search · GitHub
PHP multidimensional array search. GitHub Gist: instantly share code, notes, and snippets.
🌐
SitePoint
sitepoint.com › php
Best way to do array_search on multi-dimensional array? - PHP - SitePoint Forums | Web Development & Design Community
May 23, 2012 - Also i doubt you would be able to find an exact code source for what your wanting as retrieving the index for a specific search is faster then storing each key index. ... function array_find_deep($array, $search, $keys = array()) { foreach($array as $key => $value) { if (is_array($value)) { $sub = array_find_deep($value, $search, array_merge($keys, array($key))); if (count($sub)) { return $sub; } } elseif ($value === $search) { return array_merge($keys, array($key)); } } return array(); } $a = array( 'key1' => array( 'key2' => array( 'key3' => 'value', 'key4' => array( 'key5' => 'value2' ) ) )
Find elsewhere
🌐
W3Schools
w3schools.com › php › php_arrays_multidimensional.asp
PHP Multidimensional Arrays
PHP supports multidimensional arrays that are two, three, four, five, or more levels deep.
🌐
TutorialsPoint
tutorialspoint.com › how-to-search-by-key-value-in-a-multidimensional-array-in-php
How to Search by key=value in a Multidimensional Array in PHP
Here's an example of using array_filter() and array_column() to search for a key-value pair in a multidimensional array in PHP:
🌐
W3Schools
w3schools.com › php › func_array_search.asp
PHP array_search() Function
The array_search() function search an array for a value and returns the key. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, ...
🌐
GitHub
gist.github.com › ed219ace22a029782b8b
array_search for multidimensional arrays
array_search for multidimensional arrays · Raw · recursive_array_search.php · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
🌐
GeeksforGeeks
geeksforgeeks.org › php › how-to-search-by-keyvalue-in-a-multidimensional-array-in-php
How to search by key=>value in a multidimensional array in PHP ? - GeeksforGeeks
July 15, 2024 - The array_filter() function in PHP can be used to search for a key-value pair in a multidimensional array by providing a custom callback function.
🌐
Uptimia
uptimia.com › home › questions › how to search a php multidimensional array by value?
How To Search A PHP Multidimensional Array By Value?
November 5, 2024 - To search a multidimensional array in PHP, you can create a function that loops through the array. This function will compare the 'uid' value of each sub-array with the search parameter.
🌐
WP-Mix
wp-mix.com › php-search-multidimensional-array
PHP Search Multidimensional Array | WP-Mix
function shapeSpace_search_array($needle, $haystack) { if (in_array($needle, $haystack)) { return true; } foreach ($haystack as $item) { if (is_array($item) && array_search($needle, $item)) return true; } return false; } This function returns true if the specified value ($needle) is found within the specified array ($haystack), or false if the value is not found in the array. Works on any array, flat/one-dimensional arrays and multidimensional arrays.
🌐
sebhastian
sebhastian.com › php-search-multidimensional-array
PHP how to search multidimensional array with key and value | sebhastian
November 2, 2022 - To handle searching a multidimensional array, you can use either the foreach statement or the array_search() function. A PHP multidimensional array can be searched to see if it has a certain value.