006.phpt 676 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Test array_pop behaviour
  3. --FILE--
  4. <?php
  5. $a = array("foo", "bar", "fubar");
  6. $b = array("3" => "foo", "4" => "bar", "5" => "fubar");
  7. $c = array("a" => "foo", "b" => "bar", "c" => "fubar");
  8. /* simple array */
  9. echo array_pop($a), "\n";
  10. array_push($a, "foobar");
  11. var_dump($a);
  12. /* numerical assoc indices */
  13. echo array_pop($b), "\n";
  14. var_dump($b);
  15. /* assoc indices */
  16. echo array_pop($c), "\n";
  17. var_dump($c);
  18. ?>
  19. --EXPECT--
  20. fubar
  21. array(3) {
  22. [0]=>
  23. string(3) "foo"
  24. [1]=>
  25. string(3) "bar"
  26. [2]=>
  27. string(6) "foobar"
  28. }
  29. fubar
  30. array(2) {
  31. [3]=>
  32. string(3) "foo"
  33. [4]=>
  34. string(3) "bar"
  35. }
  36. fubar
  37. array(2) {
  38. ["a"]=>
  39. string(3) "foo"
  40. ["b"]=>
  41. string(3) "bar"
  42. }