3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface ProcessInterface { } interface RewindIterator extends Iterator { public function previous(): void; } interface ProcessListInterface extends RewindIterator { public function append(ProcessInterface $process): void; public function clear(): void; public function isEmpty(): bool; } final class ProcessList implements ProcessListInterface { private $processes = []; public function __construct(array $processes = []) { foreach ($processes as $process) { $this->append($process); } } public function append(ProcessInterface $process): void { $this->processes[] = $process; } public function clear(): void { $this->processes = []; } public function isEmpty(): bool { return empty($this->processes); } public function rewind(): ProcessInterface { return reset($this->processes); } public function current(): ProcessInterface { return current($this->processes); } public function key(): int { return key($this->processes); } public function next(): ProcessInterface { return next($this->processes); } public function previous(): ProcessInterface { return prev($this->processes); } public function valid(): bool { return key($this->processes) !== null; } }
Output for 7.0.0 - 7.3.0beta1
Fatal error: Declaration of ProcessList::previous(): ProcessInterface must be compatible with RewindIterator::previous(): void in /in/STpuP on line 19
Process exited with code 255.
Output for hhvm-3.15.4
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/STpuP on line 9
Process exited with code 255.