3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Wagon {} class Train { public function __construct(array $wagons) { $this->wagons = (function (Wagon ...$wagons) { return $wagons; })(...$wagons); } } var_dump(new Train([new Wagon, new Wagon, new Wagon]));

preferences:
58.21 ms | 404 KiB | 5 Q