????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.191 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/array/ |
Upload File : |
--TEST--
Test array_shift() function : usage variations - multi-dimensional arrays
--FILE--
<?php
/* Prototype : mixed array_shift(array &$stack)
* Description: Pops an element off the beginning of the array
* Source code: ext/standard/array.c
*/
/*
* Test popping elements from a sub-array and popping an array from an array
*/
echo "*** Testing array_shift() : usage variations ***\n";
$stack_first = array(array(1, 2, 3), 'one', 'two');
$stack_last = array ('zero', 'one', array (1, 2, 3));
echo "\n-- Before shift: --\n";
echo "---- \$stack_first:\n";
var_dump($stack_first);
echo "---- \$stack_last:\n";
var_dump($stack_last);
echo "\n-- After shift: --\n";
echo "---- Pop array from array:\n";
echo "Returned value:\t";
var_dump(array_shift($stack_first));
echo "New array:\n";
var_dump($stack_first);
echo "---- Pop element from array within array:\n";
echo "Returned value:\t";
var_dump(array_shift($stack_last[2]));
echo "New array:\n";
var_dump($stack_last);
echo "Done";
?>
--EXPECTF--
*** Testing array_shift() : usage variations ***
-- Before shift: --
---- $stack_first:
array(3) {
[0]=>
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
[1]=>
string(3) "one"
[2]=>
string(3) "two"
}
---- $stack_last:
array(3) {
[0]=>
string(4) "zero"
[1]=>
string(3) "one"
[2]=>
array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
}
-- After shift: --
---- Pop array from array:
Returned value: array(3) {
[0]=>
int(1)
[1]=>
int(2)
[2]=>
int(3)
}
New array:
array(2) {
[0]=>
string(3) "one"
[1]=>
string(3) "two"
}
---- Pop element from array within array:
Returned value: int(1)
New array:
array(3) {
[0]=>
string(4) "zero"
[1]=>
string(3) "one"
[2]=>
array(2) {
[0]=>
int(2)
[1]=>
int(3)
}
}
Done