<?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);
You have javascript disabled. You will not be able to edit any code.