3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php error_reporting(-1); function load($name) { $logger->log[] = array('load', __FILE__, $test); return new $test(); } class foo {} $result = load('foo'); print_r($result);
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: test in /in/SiqPs on line 6 Notice: Undefined variable: test in /in/SiqPs on line 7 Fatal error: Uncaught Error: Class name must be a valid object or a string in /in/SiqPs:7 Stack trace: #0 /in/SiqPs(12): load('foo') #1 {main} thrown in /in/SiqPs on line 7
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: test in /in/SiqPs on line 6 Fatal error: Cls: Expected string or object in /in/SiqPs on line 7
Process exited with code 255.
Output for 5.2.3 - 5.6.28
Notice: Undefined variable: test in /in/SiqPs on line 6 Notice: Undefined variable: test in /in/SiqPs on line 7 Fatal error: Class name must be a valid object or a string in /in/SiqPs on line 7
Process exited with code 255.
Output for 5.0.4 - 5.2.2
<br /> <b>Notice</b>: Undefined variable: test in <b>/in/SiqPs</b> on line <b>6</b><br /> <br /> <b>Notice</b>: Undefined variable: test in <b>/in/SiqPs</b> on line <b>7</b><br /> <br /> <b>Fatal error</b>: Class name must be a valid object or a string in <b>/in/SiqPs</b> on line <b>7</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.0.3
<br /> <b>Notice</b>: Undefined variable: test in <b>/in/SiqPs</b> on line <b>6</b><br /> <br /> <b>Notice</b>: Undefined variable: test in <b>/in/SiqPs</b> on line <b>7</b><br /> <br /> <b>Fatal error</b>: Class name must be a valid object or a string in <b>/in/SiqPs</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.9
<br /> <b>Notice</b>: Undefined variable: test in <b>/in/SiqPs</b> on line <b>6</b><br /> <br /> <b>Notice</b>: Undefined variable: test in <b>/in/SiqPs</b> on line <b>7</b><br /> <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: in <b>/in/SiqPs</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Notice</b>: Undefined variable: test in <b>/in/SiqPs</b> on line <b>6</b><br /> <br /> <b>Notice</b>: Undefined variable: test in <b>/in/SiqPs</b> on line <b>7</b><br /> <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: in <b>/in/SiqPs</b> on line <b>7</b><br />