array-column
How to check if a specific value exists at a specific key in any subarray of a multidimensional array?
Nothing will be faster than a simple loop. You can mix-and-match some array functions to do it, but they’ll just be implemented as a loop too. function whatever($array, $key, $val) { foreach ($array as $item) if (isset($item[$key]) && $item[$key] == $val) return true; return false; }
Return single column from a multi-dimensional array [duplicate]
Quite simple: $input = array( array( ‘tag_name’ => ‘google’ ), array( ‘tag_name’ => ‘technology’ ) ); echo implode(‘, ‘, array_map(function ($entry) { return $entry[‘tag_name’]; }, $input)); http://3v4l.org/ltBZ0 and new in php v5.5.0, array_column: echo implode(‘, ‘, array_column($input, ‘tag_name’));