2
Test sizeof() function : error conditions
5
/* Prototype : int sizeof(mixed $var[, int $mode] )
6
* Description: Counts an elements in an array. If Standard PHP Library is installed,
7
* it will return the properties of an object.
8
* Source code: ext/standard/basic_functions.c
9
* Alias to functions: count()
12
// Calling sizeof() with zero and more than expected arguments .
14
echo "*** Testing sizeof() : error conditions ***\n";
16
echo "-- Testing sizeof() with zero arguments --\n";
18
echo "-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --\n";
21
var_dump( sizeof($var, COUNT_NORMAL, $extra_arg) );
22
echo "-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --\n";
23
var_dump( sizeof($var, COUNT_RECURSIVE, $extra_arg) );
28
*** Testing sizeof() : error conditions ***
29
-- Testing sizeof() with zero arguments --
31
Warning: sizeof() expects at least 1 parameter, 0 given in %s on line %d
33
-- Testing sizeof() function with more than two arguments under COUNT_NORMAL mode --
35
Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d
37
-- Testing sizeof() function with more than two arguments under COUNT_RECURSIVE mode --
39
Warning: sizeof() expects at most 2 parameters, 3 given in %s on line %d