3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( "mac_address"=>"989096e255a1", "status" =>"Known", "attributes" => array( "Owner"=>"rogue@wpi.edu", "IPAM-Hostname"=>"dresden.wpi.edu", "IPAM-AdminState"=>"OK", "IPAM-NAS-IP-Address"=>"", "IPAM-NAS-Port-ID"=>"", "IPAM-RADIUS-VLAN"=>"", "IPAM-TimeStamp"=>"2017-07-11 11:18:33 EDT", "Guest Role ID"=>"", "MAC-Auth Expiry"=>"", "Username"=>"", ), "Username"=>"", ); $filtered = array_filter($arr, function($var) {if(is_array($var)){return array_map('array_filter', $var);}else{return !empty($var);}} ); print_r($filtered);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, string given in /in/5r80U:22 Stack trace: #0 [internal function]: array_filter('rogue@wpi.edu') #1 /in/5r80U(22): array_map('array_filter', Array) #2 [internal function]: {closure}(Array) #3 /in/5r80U(21): array_filter(Array, Object(Closure)) #4 {main} thrown in /in/5r80U on line 22
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:
60.05 ms | 401 KiB | 8 Q