I have this PHP code:
$entityElementCount = (-($highScore-$totalKeywordCount))/0.29;
What i want to know is, how to check whether $entityElementCount is a whole number (2, 6, …) or partial (2.33, 6.2, …).
Thank you!
Advertisement
Answer
$entityElementCount = (-($highScore-$totalKeywordCount))/0.29; if (ctype_digit($entityElementCount) ){ // (ctype_digit((string)$entityElementCount)) // as advised. print "whole numbern"; }else{ print "not whole numbern"; }