I am using explode
in PHP, because I need to separate a string. of this type:
$Data = '10 x 4';
I need to separate the numbers because then I do a math operation on them . The code I have works well when they are integers. If I have a string of this type 10 x 2.5
it does not take into account the decimal part that would be the , 5
. How can I do to make me take this part into account too?
$data = '10 x 2,5';
$array = explode("x", $data);
$total = $array[0]*$array[1];