I have following array:
Array
(
[ALFA] => 474
[BETA] => 359
[GAMMA] => 248
[DELTA] => 147
[EPSILON] => 137
[ZETA] => 135
)
and would like to divide it by a constant X, for example 213, so in the end I have following array as result:
Array
(
[ALFA] => 2.2253
[BETA] => 1.6854
[GAMMA] => 1.1643
[DELTA] => 0.6901
[EPSILON] => 0.6431
[ZETA] => 0.6338
)
I'm doing this
foreach($array as $v){
$newArray[] = ($v / $divisor); //in our examploe $divisor = 213.
}
but then the new array has indexed keys just like that:
Array
(
[0] => 2.2253
[1] => 1.6854
[2] => 1.1643
[3] => 0.6901
[4] => 0.6431
[5] => 0.6338
)
Many thanks in advance!