I was just curious about this to see how this might work.
$number = "3/4";
echo $number;
and I get 3/4 as a string
$number = 3/4;
echo $number;
and I get 0.75 because it’s doing the math
I am curious to see if there is a way to strip the “/” from the first one and have it divide number before the “/” by the number after the “/” so that it would come out as 0.75 instead of 3/4.
The reason I am building a form for a person who wants them to input the number in decimal form. However if a person inputs 3/4 I am going to kick an error that asks them to input it in decimal form and give them the decimal number.
You can
explode()the expression using the “/” as the delimited then just do the math on the numbers.Hope this helps