3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class x { function foo() { print "foo"; } function bar() { $x = array(get_class(), "self::foo"); call_user_func($x); $x(); } } $a = new x; $a->bar(); ?>
based on pqZdR
Output for 7.0.0 - 7.1.0
foo Fatal error: Uncaught Error: Call to undefined method x::self::foo() in /in/PaKsD:9 Stack trace: #0 /in/PaKsD(13): x->bar() #1 {main} thrown in /in/PaKsD on line 9
Process exited with code 255.
Output for 5.4.0 - 5.6.28
foo Fatal error: Call to undefined method x::self::foo() in /in/PaKsD on line 9
Process exited with code 255.
Output for 5.2.3 - 5.3.29
foo Fatal error: Function name must be a string in /in/PaKsD on line 9
Process exited with code 255.
Output for 5.1.2 - 5.2.2
foo<br /> <b>Fatal error</b>: Function name must be a string in <b>/in/PaKsD</b> on line <b>9</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.1.1
<br /> <b>Warning</b>: call_user_func(x::self::foo) [<a href='function.call-user-func'>function.call-user-func</a>]: First argument is expected to be a valid callback in <b>/in/PaKsD</b> on line <b>8</b><br /> <br /> <b>Fatal error</b>: Function name must be a string in <b>/in/PaKsD</b> on line <b>9</b><br />
Process exited with code 255.
Output for 4.4.5 - 4.4.9
<br /> <b>Warning</b>: Wrong parameter count for get_class() in <b>/in/PaKsD</b> on line <b>7</b><br /> <br /> <b>Warning</b>: call_user_func(Array) [<a href='function.call-user-func'>function.call-user-func</a>]: First argument is expected to be a valid callback in <b>/in/PaKsD</b> on line <b>8</b><br /> <br /> <b>Fatal error</b>: Call to undefined function: array() in <b>/in/PaKsD</b> on line <b>9</b><br />
Process exited with code 255.
Output for 4.4.3 - 4.4.4
<br /> <b>Warning</b>: Wrong parameter count for get_class() in <b>/in/PaKsD</b> on line <b>7</b><br /> <br /> <b>Warning</b>: call_user_func(Array) [<a href='function.call-user-func'>function.call-user-func</a>]: First argument is expected to be a valid callback in <b>/in/PaKsD</b> on line <b>8</b><br /> <br /> <b>Fatal error</b>: Call to undefined function: array() in <b>/in/PaKsD</b> on line <b>9</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.2
<br /> <b>Warning</b>: Wrong parameter count for get_class() in <b>/in/PaKsD</b> on line <b>7</b><br /> <br /> <b>Warning</b>: call_user_func(Array): First argument is expected to be a valid callback in <b>/in/PaKsD</b> on line <b>8</b><br /> <br /> <b>Fatal error</b>: Call to undefined function: array() in <b>/in/PaKsD</b> on line <b>9</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Warning</b>: Wrong parameter count for get_class() in <b>/in/PaKsD</b> on line <b>7</b><br /> <br /> <b>Warning</b>: call_user_func(Array) [<a href='http://www.php.net/function.call-user-func'>function.call-user-func</a>]: First argument is expected to be a valid callback in <b>/in/PaKsD</b> on line <b>8</b><br /> <br /> <b>Fatal error</b>: Call to undefined function: array() in <b>/in/PaKsD</b> on line <b>9</b><br />