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.
You can use the following to check if a string is a float:
$a = "1.23"; $isFloat = ($a == (string)(float)$a);