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

javascript - Iterate over array and calculate average values of array-parts -

iphone - Using nested NSDictionary with Picker -

objective c - Newbie question -multiple parameters -