3v4l.org

run code in 500+ PHP versions simultaneously
<?php $a = [1,2]; $b = [3,4]; $newArray = []; foreach ($a as $index => $value) { $newArray[] = [ $a[$index], $b[$index] ]; } // Echo as JSON for readability echo json_encode($newArray);

preferences:
101.77 ms | 1278 KiB | 5 Q