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