import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-array / array_diff_assoc_variation3.php
blobddd28054a0183d8240f334994bf10a9829070a29
1 <?php
2 /* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
3 * Description: Returns the entries of arr1 that have values which are not present
4 * in any of the others arguments but do additional checks whether the keys are equal
5 * Source code: ext/standard/array.c
6 */
8 /*
9 * Test how array_diff_assoc() compares indexed arrays containing different data types
12 echo "\n*** Testing array_diff_assoc() : usage variations ***\n";
14 $array = array(1, 2, 3);
16 //get an unset variable
17 $unset_var = 10;
18 unset ($unset_var);
20 // get a class
21 class classA
23 public function __toString() {
24 return "Class A object";
28 // heredoc string
29 $heredoc = <<<EOT
30 hello world
31 EOT;
33 //array of different data types to be passed to $arr1 argument
34 $inputs = array(
36 // int data
37 /*1*/
38 'int' => array(
41 12345,
42 -2345),
44 // float data
45 /*2*/
46 'float' => array(
47 10.5,
48 -10.5,
49 12.3456789000e10,
50 12.3456789000E-10,
51 .5),
53 // null data
54 /*3*/
55 'null' => array(
56 NULL,
57 null),
59 // boolean data
60 /*4*/
61 'bool' => array(
62 true,
63 false,
64 TRUE,
65 FALSE),
67 // empty data
68 /*5*/
69 'empty' => array(
70 "",
71 ''),
73 // string data
74 /*6*/
75 'string' => array(
76 "string",
77 'string',
78 $heredoc),
80 // binary data
81 /*7*/
82 'binary' => array(
83 b"binary",
84 (binary)"binary"),
86 // object data
87 /*8*/
88 'object' => array(
89 new classA()),
91 // undefined data
92 /*9*/
93 'undefined' => array(
94 @$undefined_var),
96 // unset data
97 /*10*/
98 'unset' => array(
99 @$unset_var),
102 // loop through each element of $inputs to check the behavior of array_diff_assoc
103 $iterator = 1;
104 foreach($inputs as $key => $input) {
105 echo "\n-- Iteration $iterator --\n";
106 var_dump( array_diff_assoc($input, $array));
107 $iterator++;
109 echo "Done";