3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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); }
Output for 5.2.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Use of undefined constant FSU - assumed 'FSU' in /in/ub8C0(17) : runtime-created function on line 1 Notice: Use of undefined constant FSU - assumed 'FSU' in /in/ub8C0(17) : runtime-created function on line 1 Notice: Use of undefined constant FSU - assumed 'FSU' in /in/ub8C0(17) : runtime-created function on line 1 Notice: Use of undefined constant FSU - assumed 'FSU' in /in/ub8C0(17) : runtime-created function on line 1 Array ( [0] => Array ( [StartDate] => 2014/07/31 [LocZipCode] => 19406 [LocationURL] => FSU [EventType] => UN ) [1] => Array ( [StartDate] => 2014/08/31 [LocZipCode] => 23513 [LocationURL] => FSU [EventType] => UN ) )
Output for hhvm-3.10.0 - 3.12.0
Notice: Use of undefined constant FSU - assumed 'FSU' Notice: Use of undefined constant FSU - assumed 'FSU' Notice: Use of undefined constant FSU - assumed 'FSU' Notice: Use of undefined constant FSU - assumed 'FSU' Array ( [0] => Array ( [StartDate] => 2014/07/31 [LocZipCode] => 19406 [LocationURL] => FSU [EventType] => UN ) [1] => Array ( [StartDate] => 2014/08/31 [LocZipCode] => 23513 [LocationURL] => FSU [EventType] => UN ) )
Output for 5.0.0 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/ub8C0 on line 2
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/ub8C0 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/ub8C0 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/ub8C0 on line 2