3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface i { protected function getVar(); public function __construct(); } class a implements i { protected $var; public function __construct() { $this->var = 'no value'; } public function getVar() { return $this->var; } } class b extends a { public function __construct($var = 'no value') { $this->var = $var; } } $a = new a(); echo $a->getVar()."\n"; $b = new b('a value'); echo $b->getVar()."\n";
Output for 5.3.0 - 5.3.18, 5.4.0 - 5.4.8
Fatal error: Access type for interface method i::getVar() must be omitted in /in/GfISY on line 5
Process exited with code 255.

preferences:
171.59 ms | 1395 KiB | 35 Q