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