Annotation of embedaddon/php/ext/standard/tests/array/prev_variation2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test prev() function : usage variation - Multi-dimensional arrays
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : mixed prev(array $array_arg)
! 6: * Description: Move array argument's internal pointer to the previous element and return it
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: /*
! 11: * Test prev() when passed:
! 12: * 1. a two-dimensional array
! 13: * 2. a sub-array
! 14: * as $array_arg argument.
! 15: */
! 16:
! 17: echo "*** Testing prev() : usage variations ***\n";
! 18:
! 19: $subarray = array(9,8,7);
! 20: end($subarray);
! 21:
! 22: $array_arg = array ($subarray, 'a' => 'z');
! 23: end($array_arg);
! 24:
! 25: echo "\n-- Pass a two-dimensional array as \$array_arg --\n";
! 26: var_dump(prev($array_arg));
! 27: var_dump(prev($array_arg));
! 28:
! 29: echo "\n-- Pass a sub-array as \$array_arg --\n";
! 30: var_dump(prev($array_arg[0]));
! 31: ?>
! 32: ===DONE===
! 33: --EXPECTF--
! 34: *** Testing prev() : usage variations ***
! 35:
! 36: -- Pass a two-dimensional array as $array_arg --
! 37: array(3) {
! 38: [0]=>
! 39: int(9)
! 40: [1]=>
! 41: int(8)
! 42: [2]=>
! 43: int(7)
! 44: }
! 45: bool(false)
! 46:
! 47: -- Pass a sub-array as $array_arg --
! 48: int(8)
! 49: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>