3v4l.org

run code in 300+ PHP versions simultaneously
<?php <?php function getUA($data, $univ_seg) { return array_filter(json_decode($data, true), function($var) use($univ_seg) { return $var["EventType"] == "UN" && $var["LocationURL"] == $univ_seg; }); } $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") )); $univ_seg = 'FSU'; $ua = getUA($data, $univ_seg); print_r($ua);
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.28, 5.4.0 - 5.4.31
Parse error: syntax error, unexpected '<' in /in/2VdHh on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '<' in /in/2VdHh on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/2VdHh on line 2
Process exited with code 255.

preferences:
234.06 ms | 1395 KiB | 121 Q