3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test_print($item, $key) { echo "$key holds $item\n"; } function recursion($array, $key_parent) { if(count($array) == 0) return; foreach (new RecursiveIteratorIterator( new RecursiveArrayIterator($array), RecursiveIteratorIterator::CATCH_GET_CHILD) as $key => $value) { if(is_array($value)) { echo 'My Array Node ' . $key; recursion($value); } else { //echo 'My node ' . $key . ' with value ' . $value . PHP_EOL; if($key == $key_parent) $array[$key] = "**"; } } } $information = array("login" => "someUsername", "password" => "somePassword", "card_pin"=>"card_1234", "pin"=>"pin_356", "iin" => "iin_123", "shipping" => array("telephone" => "telephone_998"), "cardnumber" => "card_number_876", "customer_id" => "customer_654"); $list = "login,customer_id"; print_r($information); //array_walk_recursive($information, 'test_print'); recursion($information, "login"); print_r($information);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [login] => someUsername [password] => somePassword [card_pin] => card_1234 [pin] => pin_356 [iin] => iin_123 [shipping] => Array ( [telephone] => telephone_998 ) [cardnumber] => card_number_876 [customer_id] => customer_654 ) My Array Node shipping Fatal error: Uncaught ArgumentCountError: Too few arguments to function recursion(), 1 passed in /in/V7cui on line 21 and exactly 2 expected in /in/V7cui:8 Stack trace: #0 /in/V7cui(21): recursion(Array) #1 /in/V7cui(44): recursion(Array, 'login') #2 {main} thrown in /in/V7cui on line 8
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
56.54 ms | 402 KiB | 8 Q