3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function wtf(array $arrayUnderTest) { echo is_callable($arrayUnderTest) ? 'This is a callable' : 'This is not a callable'; echo "\n"; echo is_array($arrayUnderTest) ? 'This is an array' : 'This is not an array'; $arrayUnderTest(); } class x { function foo() { print "\nfoo"; } } $x = new x(); $test = array($x, "foo"); $testStdClass = array(new \StdClass(), '__construct'); wtf($test); wtf($testStdClass);
based on fSrTV
Output for 7.0.0 - 7.2.0
This is a callable This is an array fooThis is not a callable This is an array Fatal error: Uncaught Error: Call to undefined method stdClass::__construct() in /in/XlCtW:7 Stack trace: #0 /in/XlCtW(22): wtf(Array) #1 {main} thrown in /in/XlCtW on line 7
Process exited with code 255.
Output for 5.4.2 - 5.6.28
This is a callable This is an array fooThis is not a callable This is an array Fatal error: Call to undefined method stdClass::__construct() in /in/XlCtW on line 7
Process exited with code 255.
Output for 5.3.17 - 5.3.29
This is a callable This is an array Fatal error: Function name must be a string in /in/XlCtW on line 7
Process exited with code 255.