3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = ['a','b','c']; foreach ($arr as $dummy) { $arr = [1,2,3]; var_dump($dummy); } var_dump($arr);
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.30, 8.0.0 - 8.0.23, 8.1.0 - 8.1.10
string(1) "a" string(1) "b" string(1) "c" array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) }

preferences:
47.67 ms | 409 KiB | 5 Q