Annotation of embedaddon/php/ext/standard/tests/array/array_values_variation6.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test array_values() function : usage variations - Referenced variables
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : array array_values(array $input)
                      6:  * Description: Return just the values from the input array 
                      7:  * Source code: ext/standard/array.c
                      8:  */
                      9: 
                     10: /*
                     11:  * Test array_values() when:
                     12:  * 1. Passed an array made up of referenced variables
                     13:  * 2. Passed an array by reference
                     14:  */
                     15: 
                     16: echo "*** Testing array_values() : usage variations ***\n";
                     17: 
                     18: $val1 = 'one';
                     19: $val2 = 'two';
                     20: $val3 = 'three';
                     21: 
                     22: echo "\n-- \$input is an array made up of referenced variables: --\n";
                     23: $input = array(&$val1, &$val2, &$val3);
                     24: var_dump($result1 = array_values($input));
                     25: 
                     26: echo "Change \$val2 and check result of array_values():\n";
                     27: $val2 = 'deux';
                     28: var_dump($result1);
                     29: 
                     30: echo "Done";
                     31: ?>
                     32: 
                     33: --EXPECTF--
                     34: *** Testing array_values() : usage variations ***
                     35: 
                     36: -- $input is an array made up of referenced variables: --
                     37: array(3) {
                     38:   [0]=>
                     39:   &string(3) "one"
                     40:   [1]=>
                     41:   &string(3) "two"
                     42:   [2]=>
                     43:   &string(5) "three"
                     44: }
                     45: Change $val2 and check result of array_values():
                     46: array(3) {
                     47:   [0]=>
                     48:   &string(3) "one"
                     49:   [1]=>
                     50:   &string(4) "deux"
                     51:   [2]=>
                     52:   &string(5) "three"
                     53: }
                     54: Done

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