summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_diff_assoc_basic.phpt
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/standard/tests/array/array_diff_assoc_basic.phpt
downloadphp2-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_assoc_basic.phpt')
-rw-r--r--ext/standard/tests/array/array_diff_assoc_basic.phpt90
1 files changed, 90 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_diff_assoc_basic.phpt b/ext/standard/tests/array/array_diff_assoc_basic.phpt
new file mode 100644
index 0000000..c6b3aef
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_assoc_basic.phpt
@@ -0,0 +1,90 @@
+--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";
+?>
+--EXPECTF--
+*** Testing array_diff_assoc() : basic functionality ***
+-- Compare Default keys to numeric keys --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "three"
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+
+-- Compare Default keys to string keys --
+array(3) {
+ [0]=>
+ string(3) "one"
+ [1]=>
+ int(2)
+ [2]=>
+ string(5) "three"
+}
+array(2) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+}
+
+-- Compare numeric keys to string keys --
+array(3) {
+ [1]=>
+ string(3) "one"
+ [2]=>
+ string(3) "two"
+ [3]=>
+ int(4)
+}
+array(3) {
+ ["one"]=>
+ int(1)
+ ["two"]=>
+ string(1) "2"
+ [3]=>
+ string(5) "three"
+}
+Done