????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.139.237.218 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 - Referenced 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 how array_shift when passed: * 1. a variable that is referenced to an array * 2. an array that contains a referenced array */ echo "*** Testing array_shift() : usage variations ***\n"; echo "\n-- Variable is referenced array --\n"; $original_array = array('zero', 'one', 'two'); $copied_array = &$original_array; echo "Result: "; var_dump(array_shift($copied_array)); echo "\n\$original_array:\n"; var_dump($original_array); echo "\n\$copied_array:\n"; var_dump($copied_array); echo "\n-- Element is referenced array --\n"; $new_array = array (&$copied_array, 1, 'two'); echo "Result: "; var_dump(array_shift($new_array[0])); echo "\n\$new_array:\n"; var_dump($new_array); echo "\n\$copied_array\n"; var_dump($copied_array); echo "Done"; ?> --EXPECTF-- *** Testing array_shift() : usage variations *** -- Variable is referenced array -- Result: string(4) "zero" $original_array: array(2) { [0]=> string(3) "one" [1]=> string(3) "two" } $copied_array: array(2) { [0]=> string(3) "one" [1]=> string(3) "two" } -- Element is referenced array -- Result: string(3) "one" $new_array: array(3) { [0]=> &array(1) { [0]=> string(3) "two" } [1]=> int(1) [2]=> string(3) "two" } $copied_array array(1) { [0]=> string(3) "two" } Done