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, "newfunc"), 1, 2); //$this->$newfunc(1, 2); } } $f = new foo();
based on MppQB
Output for 7.2.0
Deprecated: Function create_function() is deprecated in /in/hAsBh on line 7 Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' does not have a method 'newfunc' in /in/hAsBh on line 8
Output for 5.3.21 - 7.1.10
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'foo' does not have a method 'newfunc' in /in/hAsBh on line 8