3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [0, 1]; foreach ($array as $value) { $array[] = 2; } print_r($array);

preferences:
23.26 ms | 407 KiB | 5 Q