CopyPastor

Detecting plagiarism made easy.

Score: 0.8065610283710918; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2021-11-20
by Abhishek Chhabra

Original Post

Original - Posted on 2011-07-21
by cwallenpoole



            
Present in both answers; Present only in the new answer; Present only in the old answer;

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

        
Present in both answers; Present only in the new answer; Present only in the old answer;