1--TEST--
2Test 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
16echo "*** 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
21echo "\n-- Incorrect Method: --\n";
22var_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:
26echo "\n-- Correct Method: --\n";
27$result1 = array_shift($stack);
28$result2 = array_shift($result1);
29var_dump(array_shift($result2));
30
31echo "Done";
32?>
33--EXPECTF--
34*** Testing array_shift() : usage variations ***
35
36-- Incorrect Method: --
37
38Strict Standards: Only variables should be passed by reference in %s on line %d
39
40Strict Standards: Only variables should be passed by reference in %s on line %d
41string(4) "zero"
42
43-- Correct Method: --
44string(4) "zero"
45Done
46