3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Example1 { protected $v1; protected $v2; public function __construct($a, $b) { $this->v1 = $a; $this->v2 = $b; } protected function get_v1() { return $this->v1; } public function get_v2() { return $this->v2; } } echo $v2->get_v2($v2); ?>
based on fUQvk
Output for 7.0.5 - 7.2.0
Notice: Undefined variable: v2 in /in/8MRmT on line 33 Fatal error: Uncaught Error: Call to a member function get_v2() on null in /in/8MRmT:33 Stack trace: #0 {main} thrown in /in/8MRmT on line 33
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: v2 in /in/8MRmT on line 33 Fatal error: Uncaught Error: Call to a member function get_v2() on unknown in /in/8MRmT:33 Stack trace: #0 {main} thrown in /in/8MRmT on line 33
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Notice: Undefined variable: v2 in /in/8MRmT on line 33 Fatal error: Call to a member function get_v2() on null in /in/8MRmT on line 33
Process exited with code 255.
Output for 5.3.20 - 5.5.35
Notice: Undefined variable: v2 in /in/8MRmT on line 33 Fatal error: Call to a member function get_v2() on a non-object in /in/8MRmT on line 33
Process exited with code 255.