Revert "make hphpc able to use ini files"
[hiphop-php.git] / hphp / test / zend / bad / ext / standard / tests / array / array_fill_variation1.php
bloba3d0e9b726cf9c54bceac2008217c84b9c985e15
1 <?php
2 /* Prototype : proto array array_fill(int start_key, int num, mixed val)
3 * Description: Create an array containing num elements starting with index start_key each initialized to val
4 * Source code: ext/standard/array.c
5 */
7 /*
8 * testing array_fill() by passing different unexpected value for 'start_key' argument
9 */
11 echo "*** Testing array_fill() : usage variations ***\n";
13 // Initialise function arguments not being substituted
14 $num = 2;
15 $val = 100;
17 //get an unset variable
18 $unset_var = 10;
19 unset ($unset_var);
21 //get a resource variable
22 $fp = fopen(__FILE__, "r");
24 //define a class
25 class test
27 var $t = 10;
28 function __toString()
30 return "testObject";
35 //array of different values for 'start_key' argument
36 $values = array(
38 // float values
39 /* 1 */ 10.5,
40 -10.5,
41 12.3456789000e10,
42 12.34567890006E-10,
43 .5,
45 // array values
46 /* 6 */ array(),
47 array(0),
48 array(1),
49 array(1, 2),
50 array('color' => 'red', 'item' => 'pen'),
52 // null values
53 /* 11 */ NULL,
54 null,
56 // boolean values
57 /* 13 */ true,
58 false,
59 TRUE,
60 FALSE,
62 // empty string
63 /* 17 */ "",
64 '',
66 // string values
67 /* 19 */ "string",
68 'string',
70 // objects
71 /* 21 */ new test(),
73 // undefined variable
74 @$undefined_var,
76 // unset variable
77 @$unset_var,
79 // resource variable
80 /* 24 */ $fp
83 // loop through each element of the array for start_key
84 // check the working of array_fill()
85 echo "--- Testing array_fill() with different values for 'start_key' arg ---\n";
86 $counter = 1;
87 for($index = 0; $index < count($values); $index ++)
89 echo "-- Iteration $counter --\n";
90 $start_key = $values[$index];
92 var_dump( array_fill($start_key,$num,$val) );
94 $counter ++;
97 // close the resource used
98 fclose($fp);
100 echo "Done";