diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/array/array_diff_uassoc_basic.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/standard/tests/array/array_diff_uassoc_basic.phpt')
-rw-r--r-- | ext/standard/tests/array/array_diff_uassoc_basic.phpt | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_diff_uassoc_basic.phpt b/ext/standard/tests/array/array_diff_uassoc_basic.phpt new file mode 100644 index 0000000..6a96be6 --- /dev/null +++ b/ext/standard/tests/array/array_diff_uassoc_basic.phpt @@ -0,0 +1,28 @@ +--TEST-- +array_diff_uassoc(): Basic test +--FILE-- +<?php +/* +* array array_diff_uassoc ( array $array1, array $array2 [, array $..., callback $key_compare_func] ) +* Function is implemented in ext/standard/array.c +*/ +function key_compare_func($a, $b) { + if ($a === $b) { + return 0; + } + return ($a > $b) ? 1 : -1; +} +$array1 = array("a" => "green", "b" => "brown", "c" => "blue", "red"); +$array2 = array("a" => "green", "yellow", "red"); +$result = array_diff_uassoc($array1, $array2, "key_compare_func"); +var_dump($result); +?> +--EXPECT-- +array(3) { + ["b"]=> + string(5) "brown" + ["c"]=> + string(4) "blue" + [0]=> + string(3) "red" +}
\ No newline at end of file |