Annotation of embedaddon/php/ext/standard/tests/array/reset_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test reset() function : basic functionality
! 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: /*
! 11: * Test basic functionality of reset()
! 12: */
! 13:
! 14: echo "*** Testing reset() : basic functionality ***\n";
! 15:
! 16: $array = array('zero', 'one', 200 => 'two');
! 17:
! 18: echo "\n-- Initial Position: --\n";
! 19: echo key($array) . " => " . current($array) . "\n";
! 20:
! 21: echo "\n-- Call to next() --\n";
! 22: var_dump(next($array));
! 23:
! 24: echo "\n-- Current Position: --\n";
! 25: echo key($array) . " => " . current($array) . "\n";
! 26:
! 27: echo "\n-- Call to reset() --\n";
! 28: var_dump(reset($array));
! 29: ?>
! 30: ===DONE===
! 31: --EXPECTF--
! 32: *** Testing reset() : basic functionality ***
! 33:
! 34: -- Initial Position: --
! 35: 0 => zero
! 36:
! 37: -- Call to next() --
! 38: string(3) "one"
! 39:
! 40: -- Current Position: --
! 41: 1 => one
! 42:
! 43: -- Call to reset() --
! 44: string(4) "zero"
! 45: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>