isFloat function..
Status: Alpha
Brought to you by:
iezzip
Try to test your isFloat() function with 0 (zero) and 1 (one).
It doesn't work!
// Fixed by Marco Rodrigues <http://Marco.Tondela.org>
function isFloat($sString)
{
$sString = preg_replace('/\s/', '', $sString);
$sString = str_replace(',', '.', $sString);
if (preg_match('/^((\-)?(\d)+((\.)?(\d)+)?)$/', $sString))
return floatval($sString);
else
return false;
}
Try this one and some function like:
0, 1, 1.00, 0.01, etc..
if (isFloat("0"))
echo "yes";
else
echo "no";