3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $global_obj = null; class my_class { var $value; function my_class() { global $global_obj; $global_obj = &$this; } } $a = new my_class; $a->my_value = 5; $global_obj->my_value = 10; echo $a->my_value; ?>
Output for 7.0.0 - 7.1.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; my_class has a deprecated constructor in /in/b4uRY on line 3 Warning: Creating default object from empty value in /in/b4uRY on line 14 5
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.13.2
Warning: Creating default object from empty value in /in/b4uRY on line 14 5
Output for 5.1.3 - 5.3.29
Strict Standards: Creating default object from empty value in /in/b4uRY on line 14 5
Output for 5.0.0 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/b4uRY on line 5 Strict Standards: Creating default object from empty value in /in/b4uRY on line 14 5
Output for 4.3.0 - 4.4.9
5