Annotation of embedaddon/php/ext/standard/tests/array/array_shift_variation5.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test array_shift() function : usage variations - call recursively
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : mixed array_shift(array &$stack)
        !             6:  * Description: Pops an element off the beginning of the array 
        !             7:  * Source code: ext/standard/array.c
        !             8:  */
        !             9: 
        !            10: /*
        !            11:  * Use the result of one call to array_shift 
        !            12:  * as the $stack argument of another call to array_shift()
        !            13:  * When done in one statement causes strict error messages. 
        !            14:  */
        !            15: 
        !            16: echo "*** Testing array_shift() : usage variations ***\n";
        !            17: 
        !            18: $stack = array ( array ( array ('zero', 'one', 'two'), 'un', 'deux'), 'eins', 'zwei');
        !            19: 
        !            20: // not following strict standards
        !            21: echo "\n-- Incorrect Method: --\n";
        !            22: var_dump(array_shift(array_shift(array_shift($stack))));
        !            23: 
        !            24: $stack = array (array( array('zero', 'one', 'two'), 'un', 'deux'), 'eins', 'zwei');
        !            25: // correct way of doing above:
        !            26: echo "\n-- Correct Method: --\n";
        !            27: $result1 = array_shift($stack);
        !            28: $result2 = array_shift($result1);
        !            29: var_dump(array_shift($result2));
        !            30: 
        !            31: echo "Done";
        !            32: ?>
        !            33: --EXPECTF--
        !            34: *** Testing array_shift() : usage variations ***
        !            35: 
        !            36: -- Incorrect Method: --
        !            37: 
        !            38: Strict Standards: Only variables should be passed by reference in %s on line %d
        !            39: 
        !            40: Strict Standards: Only variables should be passed by reference in %s on line %d
        !            41: string(4) "zero"
        !            42: 
        !            43: -- Correct Method: --
        !            44: string(4) "zero"
        !            45: Done

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