1--TEST--
2Test count() function : error conditions - pass incorrect number of args
3--FILE--
4<?php
5/* Prototype  : int count(mixed var [, int mode])
6 * Description: Count the number of elements in a variable (usually an array)
7 * Source code: ext/standard/array.c
8 */
9
10/*
11 * Pass incorrect number of arguments to count() to test behaviour
12 */
13
14echo "*** Testing count() : error conditions ***\n";
15
16// Zero arguments
17echo "\n-- Testing count() function with Zero arguments --\n";
18var_dump( count() );
19
20//Test count with one more than the expected number of arguments
21echo "\n-- Testing count() function with more than expected no. of arguments --\n";
22$var = 1;
23$mode = 10;
24$extra_arg = 10;
25var_dump( count($var, $mode, $extra_arg) );
26
27echo "Done";
28?>
29--EXPECTF--
30*** Testing count() : error conditions ***
31
32-- Testing count() function with Zero arguments --
33
34Warning: count() expects at least 1 parameter, 0 given in %s on line %d
35NULL
36
37-- Testing count() function with more than expected no. of arguments --
38
39Warning: count() expects at most 2 parameters, 3 given in %s on line %d
40NULL
41Done