import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-array / array_fill_variation3.php
blobdbebb13f2190aeb7b0372daf00488bceb40b033d
1 <?php
2 /* Prototype : 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 values for 'val' argument
9 */
11 echo "*** Testing array_fill() : usage variations ***\n";
13 // Initialise function arguments not being substituted
14 $start_key = 0;
15 $num = 2;
17 //get an unset variable
18 $unset_var = 10;
19 unset ($unset_var);
21 // define a class
22 class test
24 var $t = 10;
25 function __toString()
27 return "testObject";
32 //array of different values for 'val' argument
33 $values = array(
34 // empty string
35 /* 1 */ "",
36 '',
37 // objects
38 /* 3 */ new test(),
40 // undefined variable
41 @$undefined_var,
43 // unset variable
44 /* 5 */ @$unset_var,
47 // loop through each element of the array for 'val' argument
48 // check the working of array_fill()
49 echo "--- Testing array_fill() with different values for 'val' argument ---\n";
50 $counter = 1;
51 for($index = 0; $index < count($values); $index ++)
53 echo "-- Iteration $counter --\n";
54 $val = $values[$index];
56 var_dump( array_fill($start_key , $num , $val) );
58 $counter++;
61 echo"Done";