I have a variable that ...
$whatever = "5865/100";
This is a text variable.
I want him to calculate 5865/100, so that I can add it to other numbers and do the calculation.
Number_format does not work, since it just returns "5.865". While I want him to return 58.65
I could do ...
$explode=explode("/",$whatever);
if(count($explode)=="2") {
$whatever = $explode[0]/$explode[1];
}
But it seems pretty dirty. Is there an easier way?
source
share