import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-array / sizeof_variation5.php
blobc1efeba4b602a783b65ad2c30fd730d767b64527
1 <?php
2 /* Prototype : int sizeof($mixed var[, int $mode])
3 * Description: Counts an elements in an array. If Standard PHP library is installed,
4 * it will return the properties of an object.
5 * Source code: ext/standard/basic_functions.c
6 * Alias to functions: count()
7 */
9 echo "*** Testing sizeof() : usage variations ***\n";
11 echo "--- Testing sizeof() with different values for 'mode' argument ---\n";
12 $array1 = array(1, 2, 3, 4, array(1.0, 2.0, array()), array() );
14 // get a resource variable
15 $fp = fopen(__FILE__, "r");
17 //unset variable
18 $unset_var = 10;
19 unset($unset_var);
21 //class declaration
22 class test
24 public $member1;
27 $mode_values = array (
28 /* 1 */ COUNT_NORMAL,
29 COUNT_RECURSIVE,
30 0, // same as COUNT_NORMAL
31 1, // same as COUNT_RECURSIVE
33 /* 5 */ TRUE, // same as COUNT_RECURSIVE
34 true, // same as COUNT_RECURSIVE
35 FALSE, // same as COUNT_NORMAL
36 false, // same as COUNT_NORMAL
37 NULL, // same as COUNT_NORMAL
38 /* 10 */ null, // same as COUNT_NORMAL
39 100,
40 10.5,
41 12.34e3,
42 12.34E-2,
43 /* 15 */ .5,
44 "",
45 '',
46 "string",
47 'string',
48 /* 20 */ @$unset_var,
49 new test(),
50 /* 22 */ $fp
53 // loop through the each element of $modes_array for 'mode' argument
54 // and check the working of sizeof()
55 $counter = 1;
56 for($i = 0; $i < count($mode_values); $i++)
58 echo "-- Iteration $counter --\n";
59 $mode = $mode_values[$i];
61 var_dump( sizeof($array1, $mode) );
63 $counter++;
66 fclose($fp);
68 echo "Done";