3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { protected $name = "franz"; public fucntion getName() { return $this->name; } public function setName($name) { $this->name = $name; } } class modify { public __function($a) { $a->setName('john'); } } $a = new a; print $a->getName(); $mod = new modify($a); print $a->getName();
Output for 5.4.0 - 5.4.22
Parse error: syntax error, unexpected 'fucntion' (T_STRING), expecting variable (T_VARIABLE) in /in/5Vhqf on line 5
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/5Vhqf on line 5
Process exited with code 255.

preferences:
174.93 ms | 1386 KiB | 58 Q