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

Popular posts from this blog

python - Why doesn't list have safe "get" method like dictionary? -

razor - Is this a bug in WebMatrix PageData? -

sql server - Stored procedure -