remove array_multisort and convert array_multisortN to use inout
[hiphop-php.git] / hphp / test / zend / good / ext / standard / tests / array / array_diff_key_variation1.php
blob1d90a9171909d9e2279d62b1a8f4d6b501c826b7
1 <?hh
2 /* Prototype : array array_diff_key(array arr1, array arr2 [, array ...])
3 * Description: Returns the entries of arr1 that have keys which are not present in any of the others arguments.
4 * Source code: ext/standard/array.c
5 */
7 // define some classes
8 class classWithToString
10 public function __toString() {
11 return "Class A object";
15 class classWithoutToString
18 <<__EntryPoint>> function main(): void {
19 echo "*** Testing array_diff_key() : usage variation ***\n";
21 // Initialise function arguments not being substituted (if any)
22 $array2 = array('green' => 5, 'blue' => 6, 'yellow' => 7, 'cyan' => 8);
23 $array3 = array(1, 2, 3, 4, 5);
25 //get an unset variable
26 $unset_var = 10;
27 unset ($unset_var);
29 //resource variable
30 $fp = fopen(__FILE__, "r");
32 // heredoc string
33 $heredoc = <<<EOT
34 hello world
35 EOT;
37 //array of values to iterate over
38 $inputs = array(
40 // int data
41 'int 0' => 0,
42 'int 1' => 1,
43 'int 12345' => 12345,
44 'int -12345' => -12345,
46 // float data
47 'float 10.5' => 10.5,
48 'float -10.5' => -10.5,
49 'float 12.3456789000e10' => 12.3456789000e10,
50 'float -12.3456789000e10' => -12.3456789000e10,
51 'float .5' => .5,
53 // null data
54 'uppercase NULL' => NULL,
55 'lowercase null' => null,
57 // boolean data
58 'lowercase true' => true,
59 'lowercase false' =>false,
60 'uppercase TRUE' =>TRUE,
61 'uppercase FALSE' =>FALSE,
63 // empty data
64 'empty string DQ' => "",
65 'empty string SQ' => '',
67 // string data
68 'string DQ' => "string",
69 'string SQ' => 'string',
70 'mixed case string' => "sTrInG",
71 'heredoc' => $heredoc,
73 // object data
74 'instance of classWithToString' => new classWithToString(),
75 'instance of classWithoutToString' => new classWithoutToString(),
77 // undefined data
78 'undefined var' => @$undefined_var,
80 // unset data
81 'unset var' => @$unset_var,
83 // resource data
84 'resource' => $fp,
87 // loop through each element of the array for arr1
88 foreach($inputs as $key =>$value) {
89 echo "\n--$key--\n";
90 var_dump( array_diff_key($value, $array2) );
91 var_dump( array_diff_key($value, $array2, $array3) );
94 fclose($fp);
95 echo "===DONE===\n";