3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $endpoint = array( "mac_address"=>"989096e255a1", "status" =>"Known", "attributes" => array( "Owner"=>"rogue@wpi.edu", "IPAM-Hostname"=>"dresden.wpi.edu", "IPAM-AdminState"=>"OK", "IPAM-NAS-IP-Address"=>"0", "IPAM-NAS-Port-ID"=>"1", "IPAM-RADIUS-VLAN"=>0, "IPAM-TimeStamp"=>"2017-07-11 11:18:33 EDT", "Guest Role ID"=>"false", "MAC-Auth Expiry"=>"1", "Username"=>"", ), "Username"=>"", ); $endpointcreate = array_filter($endpoint, function($var) {return !empty($var);}); $endpointcreate["attributes"] = array_filter($endpointcreate["attributes"], function($var) {return !(($var=='') || is_null($var));}); print_r($endpointcreate);
Output for 5.6.30
Array ( [mac_address] => 989096e255a1 [status] => Known [attributes] => Array ( [Owner] => rogue@wpi.edu [IPAM-Hostname] => dresden.wpi.edu [IPAM-AdminState] => OK [IPAM-NAS-IP-Address] => 0 [IPAM-NAS-Port-ID] => 1 [IPAM-TimeStamp] => 2017-07-11 11:18:33 EDT [Guest Role ID] => false [MAC-Auth Expiry] => 1 ) )