如何划分两个数组值?

I have 2 arrays with the same dimension called

$array1 = ['10','20','30'];

$array2 = ['5','10','5'];

I want the result $array1/$array2

$result = ['2','2','6'];

Any idea??

You could use array_map, but in the background it's just looping the values anyways.
Because of that I genrally use a loop myself and I can controll what the output should be.

$array1 = ['10','20','30'];
$array2 = ['5','10','5'];

foreach($array1 as $key => $val){
    $result[$key] = $val/$array2[$key];
}

var_dump($result);

will give you the expected output.
But you could also do something like this in a loop:

$array1 = ['10','20','30'];
$array2 = ['5','10','5'];

foreach($array1 as $key => $val){
    $result[$val. "/" . $array2[$key]] = $val/$array2[$key];
}

var_dump($result);

which will give you:

array(3) {
      ["10/5"] => 2
      ["20/10"] => 2
      ["30/5"] => 6
}

You can try below code:

$array1 = ['10','20','30'];
$array2 = ['5','10','5'];
$result;

foreach ($array1  as $key=>$value) {      
   $result[$key] = $value/$array2[$key];       
}    

foreach ($result  as $key) {
  echo " $key";
}