3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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);
based on 6A4FS
Output for 5.4.0 - 5.4.31
Parse error: syntax error, unexpected 'univ_seg' (T_STRING), expecting '&' or variable (T_VARIABLE) in /in/BlHQS on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting '&' or T_VARIABLE in /in/BlHQS on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION in /in/BlHQS on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION in /in/BlHQS on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/BlHQS on line 3
Process exited with code 255.