php-src/ext/standard/tests/array/array_diff_assoc_basic.phpt
Steph Fox 833f4150a1 - killed off UEXPECT
- could someone please fix var_export2.phpt? NUL is corrupted, can't fix here
2008-05-26 23:36:10 +00:00

91 lines
1.9 KiB
PHP

--TEST--
Test array_diff_assoc() function : basic functionality
--FILE--
<?php
/* Prototype : array array_diff_assoc(array $arr1, array $arr2 [, array ...])
* 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
* Source code: ext/standard/array.c
*/
/*
* Test basic functionality of array_diff_assoc
*/
echo "*** Testing array_diff_assoc() : basic functionality ***\n";
$array_default_key = array('one', 2, 'three', '4');
$array_numeric_key = array(1 => 'one', 2=> 'two', 3 => 4);
$array_string_key = array('one' => 1, 'two' => '2', '3' => 'three');
echo "-- Compare Default keys to numeric keys --\n";
var_dump(array_diff_assoc($array_default_key, $array_numeric_key));
var_dump(array_diff_assoc($array_numeric_key, $array_default_key));
echo "\n-- Compare Default keys to string keys --\n";
var_dump(array_diff_assoc($array_default_key, $array_numeric_key));
var_dump(array_diff_assoc($array_numeric_key, $array_default_key));
echo "\n-- Compare numeric keys to string keys --\n";
var_dump(array_diff_assoc($array_numeric_key, $array_string_key));
var_dump(array_diff_assoc($array_string_key, $array_numeric_key));
echo "Done";
?>
--EXPECT--
*** Testing array_diff_assoc() : basic functionality ***
-- Compare Default keys to numeric keys --
array(3) {
[0]=>
unicode(3) "one"
[1]=>
int(2)
[2]=>
unicode(5) "three"
}
array(2) {
[1]=>
unicode(3) "one"
[2]=>
unicode(3) "two"
}
-- Compare Default keys to string keys --
array(3) {
[0]=>
unicode(3) "one"
[1]=>
int(2)
[2]=>
unicode(5) "three"
}
array(2) {
[1]=>
unicode(3) "one"
[2]=>
unicode(3) "two"
}
-- Compare numeric keys to string keys --
array(3) {
[1]=>
unicode(3) "one"
[2]=>
unicode(3) "two"
[3]=>
int(4)
}
array(3) {
[u"one"]=>
int(1)
[u"two"]=>
unicode(1) "2"
[3]=>
unicode(5) "three"
}
Done