1$cnt = count(array_filter($array,function($element) {
2 return $element['your_key']=='foo';
3}));
1$people = array(
2 2 => array(
3 'name' => 'John',
4 'fav_color' => 'green'
5 ),
6 5=> array(
7 'name' => 'Samuel',
8 'fav_color' => 'blue'
9 ));
10$found_key = array_search('blue', array_column($people, 'fav_color'));
1$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');
2
3$key = array_search('green', $array); // $key = 2;
4$key = array_search('red', $array); // $key = 1;
5
1 function cmp($a, $b)
2 {
3 return strcmp($a->display_name, $b->display_name);
4 }
5
6 usort($blogusers, "cmp");
7
8 foreach ($blogusers as $bloguser)
9 {
10 ...