????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 3.148.200.145 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 current() function : usage variations - multi-dimensional arrays --FILE-- <?php /* Prototype : mixed current(array $array_arg) * Description: Return the element currently pointed to by the internal array pointer * Source code: ext/standard/array.c * Alias to functions: pos */ /* * Test how current() behaves with muti-dimensional and recursive arrays */ echo "*** Testing current() : usage variations ***\n"; echo "\n-- Two Dimensional Array --\n"; $multi_array = array ('zero', array (1, 2, 3), 'two'); echo "Initial Position: "; var_dump(current($multi_array)); echo "Next Position: "; next($multi_array); var_dump(current($multi_array)); echo "End Position: "; end($multi_array); var_dump(current($multi_array)); echo "\n-- Access an Array Within an Array --\n"; //accessing an array within an array echo "Initial Position: "; var_dump(current($multi_array[1])); echo "\n-- Recursive, Multidimensional Array --\n"; //create a recursive array $multi_array[] = &$multi_array; //See where internal pointer is after adding more elements echo "Current Position: "; var_dump(current($multi_array)); //see if internal pointer is in same position as referenced array var_dump(current($multi_array[3][3][3])); // see if internal pointer is in the same position from when accessing this inner array var_dump(current($multi_array[3][3][3][1])); ?> ===DONE=== --EXPECTF-- *** Testing current() : usage variations *** -- Two Dimensional Array -- Initial Position: string(4) "zero" Next Position: array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } End Position: string(3) "two" -- Access an Array Within an Array -- Initial Position: int(1) -- Recursive, Multidimensional Array -- Current Position: string(3) "two" string(3) "two" int(1) ===DONE===