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); }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught Error: Call to undefined function create_function() in /in/ub8C0:17 Stack trace: #0 /in/ub8C0(22): getUniv('FSU') #1 /in/ub8C0(14): getUA('[{"StartDate":"...', 'FSU') #2 {main} thrown in /in/ub8C0 on line 17
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Deprecated: Function create_function() is deprecated in /in/ub8C0 on line 17 Warning: Use of undefined constant FSU - assumed 'FSU' (this will throw an Error in a future version of PHP) in /in/ub8C0(17) : runtime-created function on line 1 Warning: Use of undefined constant FSU - assumed 'FSU' (this will throw an Error in a future version of PHP) in /in/ub8C0(17) : runtime-created function on line 1 Warning: Use of undefined constant FSU - assumed 'FSU' (this will throw an Error in a future version of PHP) in /in/ub8C0(17) : runtime-created function on line 1 Warning: Use of undefined constant FSU - assumed 'FSU' (this will throw an Error in a future version of PHP) 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 7.3.32 - 7.3.33
Warning: Use of undefined constant FSU - assumed 'FSU' (this will throw an Error in a future version of PHP) in /in/ub8C0(17) : runtime-created function on line 1 Warning: Use of undefined constant FSU - assumed 'FSU' (this will throw an Error in a future version of PHP) in /in/ub8C0(17) : runtime-created function on line 1 Warning: Use of undefined constant FSU - assumed 'FSU' (this will throw an Error in a future version of PHP) in /in/ub8C0(17) : runtime-created function on line 1 Warning: Use of undefined constant FSU - assumed 'FSU' (this will throw an Error in a future version of PHP) 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 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33
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 5.0.0 - 5.0.5, 5.1.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.3.11, 4.4.0 - 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

preferences:
328.65 ms | 401 KiB | 459 Q