Annotation of embedaddon/php/ext/standard/tests/array/key_variation3.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test key() function : usage variations
                      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 how the internal pointer is affected when two variables are referenced to each other
                     12:  */
                     13: 
                     14: echo "*** Testing key() : usage variations ***\n";
                     15: 
                     16: $array1 = array ('zero', 'one', 'two');
                     17: 
                     18: echo "\n-- Initial position of internal pointer --\n";
                     19: var_dump(key($array1));
                     20: 
                     21: // Test that when two variables are referenced to one another
                     22: // the internal pointer is the same for both
                     23: $array2 = &$array1;
                     24: 
                     25: next($array1);
                     26: 
                     27: echo "\n-- Position after calling next() --\n";
                     28: echo "\$array1: ";
                     29: var_dump(key($array1));
                     30: echo "\$array2: ";
                     31: var_dump(key($array2));
                     32: ?>
                     33: ===DONE===
                     34: --EXPECTF--
                     35: *** Testing key() : usage variations ***
                     36: 
                     37: -- Initial position of internal pointer --
                     38: int(0)
                     39: 
                     40: -- Position after calling next() --
                     41: $array1: int(1)
                     42: $array2: int(1)
                     43: ===DONE===

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>