How about? I know it's a very talked about topic but I can not find a solution if you can lend me a hand. I have an application in which I calculate the VAT and as the products I offer have different VAT I have decided to add the amount and assign it in an array whose key is the VAT that is applied I give an example:
$array_suma_productos = [
"12.5" => 29,
"21.4" => "30",
];
I clarify that the VAT is not the real right now I do not remember, the fact is that the key is in string and I have to pass it to float so I did the following
foreach ($array_suma_productos as $key => $value) {
$key=(float)$key;
$total[]=calcular_iva($key,$value);
}
The problem is that $ key gives me zero when applying float, any solution?
Thanks in advance