summaryrefslogtreecommitdiff
path: root/ext/standard/tests/array/006.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/006.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/006.phpt')
-rw-r--r--ext/standard/tests/array/006.phpt49
1 files changed, 49 insertions, 0 deletions
diff --git a/ext/standard/tests/array/006.phpt b/ext/standard/tests/array/006.phpt
new file mode 100644
index 0000000..4893ad3
--- /dev/null
+++ b/ext/standard/tests/array/006.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test array_pop behaviour
+--FILE--
+<?php
+
+array_pop($GLOBALS);
+
+$a = array("foo", "bar", "fubar");
+$b = array("3" => "foo", "4" => "bar", "5" => "fubar");
+$c = array("a" => "foo", "b" => "bar", "c" => "fubar");
+
+/* simple array */
+echo array_pop($a), "\n";
+array_push($a, "foobar");
+var_dump($a);
+
+/* numerical assoc indices */
+echo array_pop($b), "\n";
+var_dump($b);
+
+/* assoc indices */
+echo array_pop($c), "\n";
+var_dump($c);
+
+?>
+--EXPECT--
+fubar
+array(3) {
+ [0]=>
+ string(3) "foo"
+ [1]=>
+ string(3) "bar"
+ [2]=>
+ string(6) "foobar"
+}
+fubar
+array(2) {
+ [3]=>
+ string(3) "foo"
+ [4]=>
+ string(3) "bar"
+}
+fubar
+array(2) {
+ ["a"]=>
+ string(3) "foo"
+ ["b"]=>
+ string(3) "bar"
+}