import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-array / array_diff_assoc_variation6.php
blob441710fecbf8fe567f0fcb5a9859a27a4a660449
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
4 * present 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 behaves
10 * 1. When comparing an array that has similar elements
11 * but has been created in a different order
12 * 2. When doing a strict comparison of string representation
15 echo "*** Testing array_diff_assoc() : usage variations ***\n";
17 $array = array ('zero',
18 1 => 1,
19 'two' => 2.00000000000001);
21 $inputs = array (
23 //default keys => string values
24 /*1*/ array('2.00000000000001', '1', 'zero', 'a'),
26 //numeric keys => string values
27 /*2*/ array(2 => '2.00000000000001',
28 1 => '1',
29 0 => 'zero',
30 3 => 'a'),
32 //string keys => string values
33 /*3*/ array('2' => '2.00000000000001',
34 '1' => '1',
35 '0' => 'zero',
36 '3' => 'a') ,
38 //default keys => numeric values
39 /*4*/ array(2, 1, 0),
41 //numeric keys => numeric values
42 /*5*/ array(2 => 2,
43 1 => 1,
44 0 => 0),
46 //string keys => numeric values
47 /*6*/ array('two' => 2,
48 '1' => 1,
49 '0' => 0),
51 //defualt keys => float values
52 /*7*/ array(2.00000000000001, 1.00, 0.01E-9),
54 //numeric keys => float values
55 /*8*/ array(2 => 2.00000000000001,
56 1 => 1.00,
57 0 => 0.01E-9),
59 //string keys => float values
60 /*9*/ array ('two' => 2.00000000000001,
61 '1' => 1.00,
62 '0' =>0.01E-9)
65 // loop through each element of $inputs to check the behavior of array_diff_assoc
66 $iterator = 1;
67 foreach($inputs as $input) {
68 echo "\n-- Iteration $iterator --\n";
69 var_dump(array_diff_assoc($array, $input));
70 var_dump(array_diff_assoc($input, $array));
71 $iterator++;
73 echo "Done";