3v4l.org

run code in 200+ PHP versions simultaneously
<?php class A { private $a; public function __construct(string $a) { $this->a = $a; } public function doStuff() { var_dump(isset($this->a), isset($a)); echo '$this->a holds the value of : ' . $this->a . PHP_EOL; echo '$a holds the value of : ' . $a . PHP_EOL; } } $aObject = new A("helloWorld"); $aObject->doStuff();
based on hTpHT
Output for 7.1.25 - 7.3.3
bool(true) bool(false) $this->a holds the value of : helloWorld Notice: Undefined variable: a in /in/ovBDs on line 15 $a holds the value of :