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

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -