0👍
✅
You can use simple foreach
loop with json_encode
$r = [];
foreach($a1 as $k => $v){
$r[] = ['x' => $a1[$k], 'y' => $a2[$k]];
}
echo json_encode($r);