php - Check if number is decimal -
i need check in php if user entered decimal number (us way, decimal point: x.xxx)
any reliable way this?
you can of want is_float, if really need know whether has decimal in it, function above isn't terribly far (albeit wrong language):
function is_decimal( $val ) { return is_numeric( $val ) && floor( $val ) != $val; }
Comments
Post a Comment