3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { public $newfunc; public function __construct() { $this->newfunc = create_function('$a,$b','print "ln($a) + ln($b) = ".log($a * $b);'); call_user_func(array($this, $this->newfunc), 1, 2); //$this->$newfunc(1, 2); } } $f = new foo();
based on hAsBh
Output for 7.2.0
Deprecated: Function create_function() is deprecated in /in/bmrsA on line 7 Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' does not have a method '' in /in/bmrsA on line 8
Output for 5.3.0 - 7.1.10
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' does not have a method '' in /in/bmrsA on line 8
Output for 5.0.0 - 5.2.17
Warning: call_user_func(foo::): First argument is expected to be a valid callback in /in/bmrsA on line 8
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/bmrsA on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/bmrsA on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/bmrsA on line 4
Process exited with code 255.