3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = json_encode(Array( Array("StartDate"=>"2014/07/31","LocZipCode"=>"19406","LocationURL"=>"FSU","EventType"=>"UN"), Array("StartDate"=>"2014/08/31","LocZipCode"=>"23513","LocationURL"=>"FSU","EventType"=>"UN"), Array("StartDate"=>"2014/07/31","LocZipCode"=>"92108","LocationURL"=>"BU","EventType"=>"UN"), Array("StartDate"=>"2014/09/30","LocZipCode"=>"78661","LocationURL"=>"BU","EventType"=>"UN") )); // even using a global variable doesn't // make it visible in getUniv() function global $univ_seg; $univ_seg = 'FSU'; getUA($data, $univ_seg); function getUniv($univ_seg){ return create_function('$a','return $a["EventType"] == "UN" && $a["LocationURL"] == ' . $univ_seg . ';'); } function getUA($data, $univ_seg) { $univ_sched = json_decode($data, true); $re = array_filter($univ_sched, getUniv($univ_seg)); print_r($re); }

preferences:
36.19 ms | 402 KiB | 5 Q