3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [['el1','el2'],['el3','el4'],]; foreach($data as $ind=>&$ar){ $ar[] = 'el new'; } print_r($data);
based on YWbOq
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.24, 7.4.0 - 7.4.12, 8.0.0
Array ( [0] => Array ( [0] => el1 [1] => el2 [2] => el new ) [1] => Array ( [0] => el3 [1] => el4 [2] => el new ) )