1//array_search
2$result = array_search("apple", $fruit_array); // return index or false
3
4//in_array
5$result = in_array("apple", $fruit_array); // return true or false
1
2<?php
3$array = array(0 => 'blue', 1 => 'red', 2 => 'green', 3 => 'red');
4
5$key = array_search('green', $array); // $key = 2;
6$key = array_search('red', $array); // $key = 1;
7?>
8
9
1$userdb = array(
2 array(
3 'uid' => '100',
4 'name' => 'Sandra Shush',
5 'pic_square' => 'urlof100'
6 ),
7 array(
8 'uid' => '5465',
9 'name' => 'Stefanie Mcmohn',
10 'pic_square' => 'urlof100'
11 ),
12 array(
13 'uid' => '40489',
14 'name' => 'Michael',
15 'pic_square' => 'urlof40489'
16 )
17);
18