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

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

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