3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class weird { var $myvar; var $other; var $blee = 'bleeblee'; var $bla; function __construct() { $myvar = 'other'; ${'myvar'} = 'blee'; ${'$myvar'} = 'bla'; $this->myvar = "A"; $this->$myvar = "B"; $this->${'myvar'} = "C"; $this->${'$myvar'} = "D"; echo 'this->myvar: '.$this->myvar."\n"; echo 'this->$myvar: '.$this->$myvar."\n"; echo 'this->${\'myvar\'}: '.$this->${'myvar'}."\n"; echo 'this->${\'$myvar\'}: '.$this->${'$myvar'}."\n"; echo 'this->$$$$$$$myvar: '.$this->$$$$$$$myvar."\n"; echo 'this->$$$$$$${\'$$$myvar\'}: ' . $this->$$$$$$${'$$$myvar'}."\n"; } } $obj = new weird; ?>
based on feoW8
Output for 7.1.0 - 7.2.0
this->myvar: A this->$myvar: C this->${'myvar'}: C this->${'$myvar'}: D Notice: Undefined variable: blee in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined property: weird::$ in /in/dZ5av on line 23 this->$$$$$$$myvar: Notice: Undefined variable: $$$myvar in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined property: weird::$ in /in/dZ5av on line 25 this->$$$$$$${'$$$myvar'}:
Output for 7.0.0 - 7.0.20
this->myvar: A this->$myvar: C this->${'myvar'}: C this->${'$myvar'}: D Notice: Undefined variable: blee in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Fatal error: Uncaught Error: Cannot access empty property in /in/dZ5av:23 Stack trace: #0 /in/dZ5av(30): weird->__construct() #1 {main} thrown in /in/dZ5av on line 23
Process exited with code 255.
Output for 5.1.3 - 5.6.28
this->myvar: A this->$myvar: C this->${'myvar'}: C this->${'$myvar'}: D Notice: Undefined variable: blee in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Fatal error: Cannot access empty property in /in/dZ5av on line 23
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/dZ5av on line 4 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 5 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 6 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 7 this->myvar: A this->$myvar: C this->${'myvar'}: C this->${'$myvar'}: D Notice: Undefined variable: blee in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Fatal error: Cannot access empty property in /in/dZ5av on line 23
Process exited with code 255.
Output for 5.0.4
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 4 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 5 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 6 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 7 this->myvar: A this->$myvar: C this->${'myvar'}: C this->${'$myvar'}: D Notice: Undefined variable: blee in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined property: weird::$ in /in/dZ5av on line 23 this->$$$$$$$myvar: Notice: Undefined variable: $$$myvar in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined property: weird::$ in /in/dZ5av on line 25 this->$$$$$$${'$$$myvar'}:
Output for 5.0.0 - 5.0.3
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 4 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 5 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 6 Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in /in/dZ5av on line 7 this->myvar: A this->$myvar: C this->${'myvar'}: C this->${'$myvar'}: D Notice: Undefined variable: blee in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined variable: in /in/dZ5av on line 23 Notice: Undefined property: weird::$ in /in/dZ5av on line 23 this->$$$$$$$myvar: Notice: Undefined variable: $$$myvar in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined variable: in /in/dZ5av on line 25 Notice: Undefined property: weird::$ in /in/dZ5av on line 25 this->$$$$$$${'$$$myvar'}:
Output for 4.3.0 - 4.4.9