summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/array_walk_recursive1.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/tests/array/array_walk_recursive1.phpt')
-rw-r--r--ext/standard/tests/array/array_walk_recursive1.phpt54
1 files changed, 54 insertions, 0 deletions
diff --git a/ext/standard/tests/array/array_walk_recursive1.phpt b/ext/standard/tests/array/array_walk_recursive1.phpt
new file mode 100644
index 000000000..8505b70e9
--- /dev/null
+++ b/ext/standard/tests/array/array_walk_recursive1.phpt
@@ -0,0 +1,54 @@
+--TEST--
+array_walk_recursive() tests
+--FILE--
+<?php
+
+var_dump(array_walk_recursive());
+$var = 1;
+var_dump(array_walk_recursive($var,1));
+$var = array();
+var_dump(array_walk_recursive($var,""));
+
+function foo($v1, $v2, $v3) {
+ var_dump($v1);
+ var_dump($v2);
+ var_dump($v3);
+}
+
+$var = array(1,2, array(2,3));
+var_dump(array_walk_recursive($var, "foo", "data"));
+
+function foo2($v1, $v2, $v3) {
+ throw new Exception($v3);
+}
+
+try {
+ var_dump(array_walk_recursive($var,"foo2", "data"));
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+Warning: array_walk_recursive() expects at least 2 parameters, 0 given in %s on line %d
+NULL
+
+Warning: array_walk_recursive(): The argument should be an array in %s on line %d
+bool(false)
+bool(true)
+int(1)
+int(0)
+string(4) "data"
+int(2)
+int(1)
+string(4) "data"
+int(2)
+int(0)
+string(4) "data"
+int(3)
+int(1)
+string(4) "data"
+bool(true)
+string(4) "data"
+Done