import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-array / array_udiff_assoc_variation3.php
blobb66821cb4895f173005de2718c2fc60c0aae76ed
1 <?php
2 /* Prototype : array array_udiff_assoc(array arr1, array arr2 [, array ...], callback key_comp_func)
3 * Description: Returns the entries of arr1 that have values which are not present in any of the others arguments but do additional checks whether the keys are equal. Keys are compared by user supplied function.
4 * Source code: ext/standard/array.c
5 * Alias to functions:
6 */
8 echo "*** Testing array_udiff_assoc() : usage variation ***\n";
10 // Initialise function arguments not being substituted (if any)
11 $arr1 = array(1, 2);
12 $arr2 = array(1, 2);
14 //get an unset variable
15 $unset_var = 10;
16 unset ($unset_var);
18 // define some classes
19 class classWithToString
21 public function __toString() {
22 return "Class A object";
26 class classWithoutToString
30 // heredoc string
31 $heredoc = <<<EOT
32 hello world
33 EOT;
35 // add arrays
36 $index_array = array (1, 2, 3);
37 $assoc_array = array ('one' => 1, 'two' => 2);
39 //array of values to iterate over
40 $inputs = array(
42 // int data
43 'int 0' => 0,
44 'int 1' => 1,
45 'int 12345' => 12345,
46 'int -12345' => -2345,
48 // float data
49 'float 10.5' => 10.5,
50 'float -10.5' => -10.5,
51 'float 12.3456789000e10' => 12.3456789000e10,
52 'float -12.3456789000e10' => -12.3456789000e10,
53 'float .5' => .5,
55 // array data
56 'empty array' => array(),
57 'int indexed array' => $index_array,
58 'associative array' => $assoc_array,
59 'nested arrays' => array('foo', $index_array, $assoc_array),
61 // null data
62 'uppercase NULL' => NULL,
63 'lowercase null' => null,
65 // boolean data
66 'lowercase true' => true,
67 'lowercase false' =>false,
68 'uppercase TRUE' =>TRUE,
69 'uppercase FALSE' =>FALSE,
71 // empty data
72 'empty string DQ' => "",
73 'empty string SQ' => '',
75 // string data
76 'string DQ' => "string",
77 'string SQ' => 'string',
78 'mixed case string' => "sTrInG",
79 'heredoc' => $heredoc,
81 // object data
82 'instance of classWithToString' => new classWithToString(),
83 'instance of classWithoutToString' => new classWithoutToString(),
85 // undefined data
86 'undefined var' => @$undefined_var,
88 // unset data
89 'unset var' => @$unset_var,
92 // loop through each element of the array for key_comp_func
94 foreach($inputs as $key =>$value) {
95 echo "\n--$key--\n";
96 var_dump( array_udiff_assoc($arr1, $arr2, $value) );
100 ===DONE===