1--TEST-- 2Test array_search() function - error conditions 3--FILE-- 4<?php 5/* 6 * Prototype : mixed array_search ( mixed $needle, array $haystack [, bool $strict] ) 7 * Description: Searches haystack for needle and returns the key if it is found in the array, FALSE otherwise 8 * Source Code: ext/standard/array.c 9*/ 10 11echo "*** Testing error conditions of array_search() ***\n"; 12/* zero argument */ 13var_dump( array_search() ); 14 15/* unexpected no.of arguments in array_search() */ 16$var = array("mon", "tues", "wed", "thurs"); 17var_dump( array_search(1, $var, 0, "test") ); 18var_dump( array_search("test") ); 19 20/* unexpected second argument in array_search() */ 21$var="test"; 22var_dump( array_search("test", $var) ); 23var_dump( array_search(1, 123) ); 24 25echo "Done\n"; 26?> 27--EXPECTF-- 28*** Testing error conditions of array_search() *** 29 30Warning: array_search() expects at least 2 parameters, 0 given in %s on line %d 31NULL 32 33Warning: array_search() expects at most 3 parameters, 4 given in %s on line %d 34NULL 35 36Warning: array_search() expects at least 2 parameters, 1 given in %s on line %d 37NULL 38 39Warning: array_search() expects parameter 2 to be array, string given in %s on line %d 40NULL 41 42Warning: array_search() expects parameter 2 to be array, int given in %s on line %d 43NULL 44Done 45