3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php error_reporting(E_ALL); function exec_eval($code) { try { $result = @eval($code); $err = error_get_last(); return [$result, $err ? $err["message"] . PHP_EOL : $err/* // PHP5 */]; } catch(\Error $e) { // PHP7 return [null, $e->getMessage()]; } catch(\Exception $ex) { return [null, $ex->getMessage()]; } } var_dump(exec_eval("xdfadsfsd"));
based on PO8Vl
Output for 7.0.0 - 7.3.0alpha1
array(2) { [0]=> NULL [1]=> string(36) "syntax error, unexpected end of file" }
Output for 5.5.0 - 5.6.28
array(2) { [0]=> bool(false) [1]=> string(37) "syntax error, unexpected end of file " }