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