3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Pager { public function fetch($page = 0, ...$categories); } class DbPager implements Pager { public function fetch($seite = 0, ...$kategorien) { var_dump($kategorien); } } $dbPager = new DbPager(); $dbPager->fetch(page: 1, categories: 2);
Output for 8.0.0
array(2) { ["page"]=> int(1) ["categories"]=> int(2) }
Output for 7.3.0 - 7.3.23, 7.4.0 - 7.4.11
Parse error: syntax error, unexpected ':', expecting ')' in /in/MhJ79 on line 17
Process exited with code 255.
Output for 7.2.0 - 7.2.34
Parse error: syntax error, unexpected ':', expecting ',' or ')' in /in/MhJ79 on line 17
Process exited with code 255.

preferences:
165.35 ms | 458 KiB | 5 Q