3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Recursion { public static function recursionLevelOne($information, $keylist) { $global_array = array(); $keys = explode($keylist, ","); foreach($keys as $individual_key) $global_array = self::recursionLevelTwo($information, $individual_key); return $global_array; } private static function recursionLevelTwo($array, $key) { if(count($array) == 0) return; $global_array = array(); foreach($array as $k => $v) { if($k == $key) if($array[$k] != self::$asterisk) $array[$k] = self::$asterisk; else { if(is_array($v)) { $temp_array = self::recursionLevelTwo($v, $key); array_push($global_array, $temp_array); } } } return $global_array; } private static $asterisk = "**"; } $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", "telephone" => "someOtherTelephoneNumber555"); $list = "login,customer_id"; print_r($information); echo PHP.EOL; echo PHP.EOL; $global_array = Recursion::recursionLevelOne($information, $list); print_r($global_array);
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 [telephone] => someOtherTelephoneNumber555 ) Fatal error: Uncaught Error: Undefined constant "PHP" in /in/RLUaq:57 Stack trace: #0 {main} thrown in /in/RLUaq on line 57
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:
53.27 ms | 402 KiB | 8 Q