reset_variation2.phpt 801 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Test reset() function : usage variations - unset first element
  3. --FILE--
  4. <?php
  5. /* Prototype : mixed reset(array $array_arg)
  6. * Description: Set array argument's internal pointer to the first element and return it
  7. * Source code: ext/standard/array.c
  8. */
  9. /*
  10. * Unset first element of an array and test behaviour of reset()
  11. */
  12. echo "*** Testing reset() : usage variations ***\n";
  13. $array = array('a', 'b', 'c');
  14. echo "\n-- Initial Position: --\n";
  15. echo current($array) . " => " . key($array) . "\n";
  16. echo "\n-- Unset First element in array and check reset() --\n";
  17. unset($array[0]);
  18. var_dump(reset($array));
  19. ?>
  20. ===DONE===
  21. --EXPECTF--
  22. *** Testing reset() : usage variations ***
  23. -- Initial Position: --
  24. a => 0
  25. -- Unset First element in array and check reset() --
  26. string(1) "b"
  27. ===DONE===