array_push_variation5.phpt 875 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Test array_push() function : usage variations - position of internal array pointer
  3. --FILE--
  4. <?php
  5. /* Prototype : int array_push(array $stack, mixed $var [, mixed $...])
  6. * Description: Pushes elements onto the end of the array
  7. * Source code: ext/standard/array.c
  8. */
  9. /*
  10. * Check the position of the internal array pointer after calling array_push()
  11. */
  12. echo "*** Testing array_push() : usage variations ***\n";
  13. $stack = array ('one' => 'un', 'two' => 'deux');
  14. $var0 = 'zero';
  15. echo "\n-- Call array_push() --\n";
  16. var_dump($result = array_push($stack, $var0));
  17. echo "\n-- Position of Internal Pointer in Original Array: --\n";
  18. echo key($stack) . " => " . current ($stack) . "\n";
  19. echo "Done";
  20. ?>
  21. --EXPECTF--
  22. *** Testing array_push() : usage variations ***
  23. -- Call array_push() --
  24. int(3)
  25. -- Position of Internal Pointer in Original Array: --
  26. one => un
  27. Done