3 * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] )
4 * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise
5 * Source Code: ext/standard/array.c
8 /* Test array_search() with different possible needle values */
10 echo "*** Testing array_search() with different needle values ***\n";
13 array("a" => "A", 2 => "B", "C" => 3, 4 => 4, "one" => 1, "" => NULL, "b", "ab", "abcd"),
14 array(4, array(1, 2 => 3), "one" => 1, "5" => 5 ),
15 array(-1, -2, -3, -4, -2.989888, "-0.005" => "neg0.005", 2.0 => "float2", "-.9" => -.9),
18 array("abcd\x00abcd\x00abcd"),
19 array("abcd\tabcd\nabcd\rabcd\0abcdefghij")
22 $array_compare = array (
40 "abcd\x00abcd\x00abcd"
42 /* loop to check if elements in $array_compare exist in $arrays
43 using array_search() */
45 foreach($arrays as $array) {
46 foreach($array_compare as $compare) {
47 echo "-- Iteration $counter --\n";
49 var_dump(array_search($compare,$array));
51 var_dump(array_search($compare,$array,TRUE));
53 var_dump(array_search($compare,$array,FALSE));