Annotation of embedaddon/php/ext/standard/tests/array/key_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test key() function : basic functionality
! 3: --FILE--
! 4: <?php
! 5: /* Prototype : mixed key(array $array_arg)
! 6: * Description: Return the key of the element currently pointed to by the internal array pointer
! 7: * Source code: ext/standard/array.c
! 8: */
! 9:
! 10: /*
! 11: * Test basic functionality of key()
! 12: */
! 13:
! 14: echo "*** Testing key() : basic functionality ***\n";
! 15:
! 16: $array = array ('zero', 99 => 'one', 'two', 'three' => 3);
! 17: echo "\n-- Initial Position: --\n";
! 18: var_dump(key($array));
! 19:
! 20: echo "\n-- Next Position: --\n";
! 21: next($array);
! 22: var_dump(key($array));
! 23:
! 24: echo "\n-- End Position: --\n";
! 25: end($array);
! 26: var_dump(key($array));
! 27:
! 28: echo "\n-- Past end of the array --\n";
! 29: next($array);
! 30: var_dump(key($array));
! 31: ?>
! 32: ===DONE===
! 33: --EXPECTF--
! 34: *** Testing key() : basic functionality ***
! 35:
! 36: -- Initial Position: --
! 37: int(0)
! 38:
! 39: -- Next Position: --
! 40: int(99)
! 41:
! 42: -- End Position: --
! 43: string(5) "three"
! 44:
! 45: -- Past end of the array --
! 46: NULL
! 47: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>