3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Fruit { protected $mType = ' '; protected $mColor = 'Green'; public function getType() { return $this->mType; } final public function getColor() { return $this->mColor; }} final class Apple extends Fruit { protected $mType = ' '; protected $mColor = 'Red'; final public function getColor() { return "Apple:".$this->mColor; } } $generalFruit = new Fruit(); $myApple = new Appler(); echo $generalFruit->getType().":".$generalFruit->getColor() ." ".$myAplle->getType().":".$myApple->getColor();
Output for 5.3.0 - 5.4.27
Fatal error: Cannot override final method Fruit::getColor() in /in/BOYu4 on line 14
Process exited with code 255.