reset_variation2.phpt 600 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Test reset() function : usage variations - unset first element
  3. --FILE--
  4. <?php
  5. /*
  6. * Unset first element of an array and test behaviour of reset()
  7. */
  8. echo "*** Testing reset() : usage variations ***\n";
  9. $array = array('a', 'b', 'c');
  10. echo "\n-- Initial Position: --\n";
  11. echo current($array) . " => " . key($array) . "\n";
  12. echo "\n-- Unset First element in array and check reset() --\n";
  13. unset($array[0]);
  14. var_dump(reset($array));
  15. ?>
  16. --EXPECT--
  17. *** Testing reset() : usage variations ***
  18. -- Initial Position: --
  19. a => 0
  20. -- Unset First element in array and check reset() --
  21. string(1) "b"