Annotation of embedaddon/php/ext/standard/tests/array/end_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test end() function : basic functionality
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : mixed end(array $array_arg)
! 6: * Description: Advances array argument's internal pointer to the last element and return it
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: /*
! 11: * Test basic functionality of end()
! 12: */
! 13:
! 14: echo "*** Testing end() : 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 end() --\n";
! 22: var_dump(end($array));
! 23:
! 24: echo "\n-- Current Position: --\n";
! 25: echo key($array) . " => " . current($array) . "\n";
! 26:
! 27: echo "\n-- Add a new element to array --\n";
! 28: $array[2] = 'foo';
! 29: var_dump(end($array));
! 30: ?>
! 31: ===DONE===
! 32: --EXPECTF--
! 33: *** Testing end() : basic functionality ***
! 34:
! 35: -- Initial Position: --
! 36: 0 => zero
! 37:
! 38: -- Call to end() --
! 39: string(3) "two"
! 40:
! 41: -- Current Position: --
! 42: 200 => two
! 43:
! 44: -- Add a new element to array --
! 45: string(3) "foo"
! 46: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>