I have an unknwon string that could resemble a float. In that case I want to convert it to float (for calculations), otherwise leave it as a string.
How do I detect if a string represents a float number?
$a = "1.23"; // convert $a to 1.23
$b = "1.2 to 1.3"; // leave $b as is
Automatic string conversion would convert the latter to 1.2, but that's not what I want.
1? php.net/manual/en/function.is-numeric.php