You can get most of what you want from `is_float`, but if you really need to know whether it has a decimal in it, you can use the following function:
function is_decimal( $val )
{
return is_numeric( $val ) && is_float( $val ) != $val;
}
You can get most of what you want from [is_float][1], but if you *really* need to know whether it has a decimal in it, your function above isn't terribly far (albeit the wrong language):
function is_decimal( $val )
{
return is_numeric( $val ) && floor( $val ) != $val;
}
[1]: http://php.net/manual/en/function.is-float.php