3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class a { var $c; function a ($pass) { $this->c = $pass; } function print_data() { echo $this->$c; } } $a = new a(10); $a->print_data(); ?>
based on NF1uZ
Output for 7.1.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in /in/GfTme on line 2 Notice: Undefined variable: c in /in/GfTme on line 7 Notice: Undefined property: a::$ in /in/GfTme on line 7
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; a has a deprecated constructor in /in/GfTme on line 2 Notice: Undefined variable: c in /in/GfTme on line 7 Fatal error: Uncaught Error: Cannot access empty property in /in/GfTme:7 Stack trace: #0 /in/GfTme(9): a->print_data() #1 {main} thrown in /in/GfTme on line 7
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: Cannot access empty property in /in/GfTme on line 7
Process exited with code 255.
Output for 5.1.3 - 5.6.28
Notice: Undefined variable: c in /in/GfTme on line 7 Fatal error: Cannot access empty property in /in/GfTme on line 7
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/GfTme on line 3 Notice: Undefined variable: c in /in/GfTme on line 7 Fatal error: Cannot access empty property in /in/GfTme on line 7
Process exited with code 255.
Output for 5.0.4
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/GfTme on line 3 Notice: Undefined variable: c in /in/GfTme on line 7 Notice: Undefined property: a::$ in /in/GfTme on line 7
Output for 5.0.0 - 5.0.3
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/GfTme on line 3 Notice: Undefined variable: c in /in/GfTme on line 7 Notice: Undefined property: a::$ in /in/GfTme on line 7
Output for 4.3.0 - 4.4.9
Notice: Undefined variable: c in /in/GfTme on line 7 Notice: Undefined property: in /in/GfTme on line 7