i have multiple array like this
$data1 = [1,2,3];
$data2 = [a,b,c];
$data3 = [x,y,z];
and i want to join them all into multiple array like this
$data = [
1 => ['data2' => a, 'data3' => x],
2 => ['data2' => b, 'data3' => y],
3 => ['data2' => c, 'data3' => z]
];
i'm trying for loop but have no idea how to make it.
$data = [];
for ($i=0; $i < count($desa); $i++) {
$data[] .= array ($desa[$i] => [
'info' => $info[$i],
'link' => $link[$i],
'sos' => $sos[$i],
'eko' => $eko[$i]
]);
}
return $data;
can someone help me with this i'm using php