3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { /** @var array<string> */ private array $array = []; /** @return array<string> */ public function &getList(): array { return $this->array; } public function rewind(): void { reset($this->getList()); } } $f = new Foo; $f->rewind();
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14

preferences:
55.28 ms | 406 KiB | 5 Q