PHP check if variable is a whole number

后端 未结 20 1143
感动是毒
感动是毒 2020-12-29 20:05

I have this PHP code:

$entityElementCount = (-($highScore-$totalKeywordCount))/0.29;

What i want to know is, how to check whether $

20条回答
  •  -上瘾入骨i
    2020-12-29 20:43

    $entityElementCount = (-($highScore-$totalKeywordCount))/0.29;
    if (ctype_digit($entityElementCount) ){
        // (ctype_digit((string)$entityElementCount))  // as advised.
        print "whole number\n";
    }else{
        print "not whole number\n";
    }
    

提交回复
热议问题