import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-array / current_variation1.php
blobb9d2cb49a9b6e1b056d07eee8e343f1489c31886
1 <?php
2 /* Prototype : mixed current(array $array_arg)
3 * Description: Return the element currently pointed to by the internal array pointer
4 * Source code: ext/standard/array.c
5 * Alias to functions: pos
6 */
8 /*
9 * Pass different data types as $array_arg argument to current() to test behaviour
12 echo "*** Testing current() : usage variations ***\n";
14 //get an unset variable
15 $unset_var = 10;
16 unset ($unset_var);
18 // get a class
19 class classA
21 var $var1;
22 public function __toString() {
23 return "Class A object";
27 // heredoc string
28 $heredoc = <<<EOT
29 hello world
30 EOT;
32 // get a resource variable
33 $fp = fopen(__FILE__, "r");
35 // unexpected values to be passed to $array_arg argument
36 $inputs = array(
38 // int data
39 /*1*/ 0,
41 12345,
42 -2345,
44 // float data
45 /*5*/ 10.5,
46 -10.5,
47 12.3456789000e10,
48 12.3456789000E-10,
49 .5,
51 // null data
52 /*10*/ NULL,
53 null,
55 // boolean data
56 /*12*/ true,
57 false,
58 TRUE,
59 FALSE,
61 // empty data
62 /*16*/ "",
63 '',
65 // string data
66 /*18*/ "string",
67 'string',
68 $heredoc,
70 // object data
71 /*21*/ new classA(),
73 // undefined data
74 /*22*/ @$undefined_var,
76 // unset data
77 /*23*/ @$unset_var,
79 // resource variable
80 /*24*/ $fp
83 // loop through each element of $inputs to check the behavior of current()
84 $iterator = 1;
85 foreach($inputs as $input) {
86 echo "\n-- Iteration $iterator --\n";
87 var_dump( current($input) );
88 $iterator++;
91 fclose($fp);
93 ===DONE===