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

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -