3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class my_class { var $my_value = array(); function my_class ($value) { $this->my_value[] = $value; } function set_value ($value) { $this->$my_value = $value; } } $a = new my_class ("a"); $a->my_value[] = "b"; $a->set_value ("c"); $a->my_class("d");
based on gFUP3
Output for 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/59FTJ on line 2 Notice: Undefined variable: my_value in /in/59FTJ on line 11
Output for 7.0.0 - 7.0.14
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/59FTJ on line 2 Notice: Undefined variable: my_value in /in/59FTJ on line 11 Fatal error: Uncaught Error: Cannot access empty property in /in/59FTJ:11 Stack trace: #0 /in/59FTJ(17): my_class->set_value('c') #1 {main} thrown in /in/59FTJ on line 11
Process exited with code 255.
Output for hhvm-3.12.0
Fatal error: Cannot access empty property in /in/59FTJ on line 11
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.1.3 - 5.6.28
Notice: Undefined variable: my_value in /in/59FTJ on line 11 Fatal error: Cannot access empty property in /in/59FTJ on line 11
Process exited with code 255.
Output for 5.0.5 - 5.1.2
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/59FTJ on line 4 Notice: Undefined variable: my_value in /in/59FTJ on line 11 Fatal error: Cannot access empty property in /in/59FTJ on line 11
Process exited with code 255.
Output for 5.0.4
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/59FTJ on line 4 Notice: Undefined variable: my_value in /in/59FTJ on line 11
Output for 5.0.0 - 5.0.3
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/59FTJ on line 4 Notice: Undefined variable: my_value in /in/59FTJ on line 11
Output for 4.3.0 - 4.4.9
Notice: Undefined variable: my_value in /in/59FTJ on line 11