3v4l.org

run code in 300+ PHP versions simultaneously
<?php function push_to_array(&...$params): void { array_push(...$params); } $array = ['once', 'two', 'three']; $new = ['foo', 'bar']; push_to_array($array, ...$new); var_export($array);
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
array ( 0 => 'once', 1 => 'two', 2 => 'three', 3 => 'foo', 4 => 'bar', )

preferences:
55.65 ms | 851 KiB | 4 Q