3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class CallableStringifier { private static $callables = array(); public static function stringify($callable) { $id = count(self::$callables); self::$callables[$id] = $callable; return 'return ' . __CLASS__ . "::call($id, func_get_args());"; } public static function call($id, $args) { return call_user_func_array(self::$callables[$id], $args); } } $func = create_function('$arg1', CallableStringifier::stringify(function($arg1) { return $arg1; })); echo $func("echo $con;"); // outputs 1
based on ivMri
Output for 7.2.0 - 7.2.6
Deprecated: Function create_function() is deprecated in /in/23V2B on line 22 Notice: Undefined variable: con in /in/23V2B on line 24 echo ;
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.1.20
Notice: Undefined variable: con in /in/23V2B on line 24 echo ;