summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_diff_uassoc_variation13.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_uassoc_variation13.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_uassoc_variation13.phpt')
-rw-r--r--ext/standard/tests/array/array_diff_uassoc_variation13.phpt68
1 files changed, 68 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_diff_uassoc_variation13.phpt b/ext/standard/tests/array/array_diff_uassoc_variation13.phpt
new file mode 100644
index 0000000..9219426
--- /dev/null
+++ b/ext/standard/tests/array/array_diff_uassoc_variation13.phpt
@@ -0,0 +1,68 @@
+--TEST--
+Test array_diff_uassoc() function : usage variations - arrays containing referenced variables
+--FILE--
+<?php
+/* Prototype : array array_diff_uassoc(array arr1, array arr2 [, array ...], callback key_comp_func)
+ * Description: Computes the difference of arrays with additional index check which is performed by a
+ * user supplied callback function
+ * Source code: ext/standard/array.c
+ */
+
+echo "*** Testing array_diff_uassoc() : usage variation ***\n";
+
+//Initialize variables
+$ref_var = 'a';
+$array1 = array('a', $ref_var);
+$array2 = array('a' => 1, &$ref_var);
+
+echo "\n-- Testing array_diff_uassoc() function with referenced variable \$ref_var has value '$ref_var' --\n";
+var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") );
+var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") );
+
+// re-assign reference variable to different value
+$ref_var = 10.00;
+echo "\n-- Testing array_diff_uassoc() function with referenced variable \$ref_var value changed to $ref_var --\n";
+var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") );
+var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") );
+
+//When array are refenced
+$array2 = &$array1;
+echo "\n-- Testing array_diff_uassoc() function when \$array2 is referenced to \$array1 --\n";
+var_dump( array_diff_uassoc($array1, $array2, "strcasecmp") );
+var_dump( array_diff_uassoc($array2, $array1, "strcasecmp") );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing array_diff_uassoc() : usage variation ***
+
+-- Testing array_diff_uassoc() function with referenced variable $ref_var has value 'a' --
+array(1) {
+ [1]=>
+ string(1) "a"
+}
+array(1) {
+ ["a"]=>
+ int(1)
+}
+
+-- Testing array_diff_uassoc() function with referenced variable $ref_var value changed to 10 --
+array(2) {
+ [0]=>
+ string(1) "a"
+ [1]=>
+ string(1) "a"
+}
+array(2) {
+ ["a"]=>
+ int(1)
+ [0]=>
+ &float(10)
+}
+
+-- Testing array_diff_uassoc() function when $array2 is referenced to $array1 --
+array(0) {
+}
+array(0) {
+}
+===DONE===