3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person{ private $name; public function getName(){ return $this->$name; } public function setName($name){ $this->name = $name; } } //Instantiate the Person object. $person = new Person(); //Set the name to "Wayne" $person->setName('Wayne'); echo $person->getName();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $name in /in/oiUhP on line 7 Warning: Undefined property: Person::$ in /in/oiUhP on line 7
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: name in /in/oiUhP on line 7 Notice: Undefined property: Person::$ in /in/oiUhP on line 7
Output for 7.3.32 - 7.3.33

preferences:
194.86 ms | 401 KiB | 209 Q