3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class foo { var $my_public = array(); //forward php4 to constructor function foo() { $this->my_public[] = 'php4 constructor'; return $this->__construct(); } //constructor php5 function __construct() { $this->my_public[] = 'php4 constructor'; register_shutdown_function(array(&$this, "__destruct")); } function dump() { print_r($this->my_public); } } $test = new foo();
Output for 7.0.0 - 7.1.0
Warning: register_shutdown_function(): Invalid shutdown callback 'foo::__destruct' passed in /in/XOEOu on line 19
Output for hhvm-3.10.0 - 3.12.0
Warning: Invalid argument: function: method '__destruct' not found
Output for 5.1.3 - 5.6.28
Strict Standards: Redefining already defined constructor for class foo in /in/XOEOu on line 15 Warning: register_shutdown_function(): Invalid shutdown callback 'foo::__destruct' passed in /in/XOEOu on line 19
Output for 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/XOEOu on line 4 Strict Standards: Redefining already defined constructor for class foo in /in/XOEOu on line 15 Warning: register_shutdown_function(): Invalid shutdown callback 'foo::__destruct' passed in /in/XOEOu on line 19
Output for 5.0.5 - 5.1.1
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/XOEOu on line 4 Strict Standards: Redefining already defined constructor for class foo in /in/XOEOu on line 15 Warning: (Registered shutdown functions) Unable to call foo::__destruct() - function does not exist in Unknown on line 0
Output for 5.0.0 - 5.0.4
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/XOEOu on line 4 Strict Standards: Redefining already defined constructor for class foo in /in/XOEOu on line 15 Warning: Unknown: Unable to call () - function does not exist in Unknown on line 0
Output for 4.4.0 - 4.4.9
Warning: (Registered shutdown functions) Unable to call foo::__destruct() - function does not exist in Unknown on line 0
Output for 4.3.0 - 4.3.11
Warning: Unknown(): Unable to call () - function does not exist in Unknown on line 0