3v4l.org

run code in 300+ PHP versions simultaneously
<?php $matches = [ 'xyz', 'dublin', 40, 'abc', 'canada', 2 ]; $matches = array_chunk($matches,3); print_r($matches); foreach ($matches as $value) { var_dump($value); }
Output for 5.6.38, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.23, 8.3.0 - 8.3.11
Array ( [0] => Array ( [0] => xyz [1] => dublin [2] => 40 ) [1] => Array ( [0] => abc [1] => canada [2] => 2 ) ) array(3) { [0]=> string(3) "xyz" [1]=> string(6) "dublin" [2]=> int(40) } array(3) { [0]=> string(3) "abc" [1]=> string(6) "canada" [2]=> int(2) }

preferences:
51.52 ms | 408 KiB | 5 Q