3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a =[[1],[2],[2],[4],[5],[5],[3]]; Foreach($a as $b){ Echo $b[0]. "\n"; If(next($a)[0] != $b[0]) echo "\n"; }
Output for 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
1 2 2 4 5 5 3 Warning: Trying to access array offset on false in /in/VSJeQ on line 7
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29
1 2 2 4 5 5 3 Warning: Trying to access array offset on value of type bool in /in/VSJeQ on line 7
Output for 7.4.0 - 7.4.33
1 2 2 4 5 5 3 Notice: Trying to access array offset on value of type bool in /in/VSJeQ on line 7
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
1 2 2 4 5 5 3
Output for 5.6.0 - 5.6.40
1 2 2 4 5 5 3

preferences:
156.68 ms | 411 KiB | 5 Q