import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-array / natcasesort_variation1.php
blob67a50befea2a515024488c4db9356a776d3f0310
1 <?php
2 /* Prototype : bool natcasesort(array &$array_arg)
3 * Description: Sort an array using case-insensitive natural sort
4 * Source code: ext/standard/array.c
5 */
7 /*
8 * Pass different data types as $array_arg argument to natcasesort() to test behaviour
9 */
11 echo "*** Testing natcasesort() : usage variation ***\n";
13 //get an unset variable
14 $unset_var = 10;
15 unset ($unset_var);
17 // get a class
18 class classA
20 public function __toString() {
21 return "Class A object";
25 // heredoc string
26 $heredoc = <<<EOT
27 hello world
28 EOT;
30 // get a resource variable
31 $fp = fopen(__FILE__, "r");
33 // unexpected values to be passed to $array_arg argument
34 $inputs = array(
36 // int data
37 /*1*/ 0,
39 12345,
40 -2345,
42 // float data
43 /*5*/ 10.5,
44 -10.5,
45 12.3456789000e10,
46 12.3456789000E-10,
47 .5,
49 // null data
50 /*10*/ NULL,
51 null,
53 // boolean data
54 /*12*/ true,
55 false,
56 TRUE,
57 FALSE,
59 // empty data
60 /*16*/ "",
61 '',
62 array(),
64 // string data
65 /*19*/ "string",
66 'string',
67 $heredoc,
69 // object data
70 /*22*/ new classA(),
72 // undefined data
73 /*23*/ @$undefined_var,
75 // unset data
76 /*24*/ @$unset_var,
78 // resource variable
79 /*25*/ $fp
82 // loop through each element of $inputs to check the behavior of natcasesort()
83 $iterator = 1;
84 foreach($inputs as $input) {
85 echo "\n-- Iteration $iterator --\n";
86 var_dump( natcasesort($input) );
87 $iterator++;
90 fclose($fp);
92 echo "Done";