isinteger - PHP check if is integer -
i have following calculation:
$this->count = float(44.28) $multiple = float(0.36) $calc = $this->count / $multiple; $calc = 44.28 / 0.36 = 123
now want check if variable $calc
integer (has decimals) or not.
i tried doing if(is_int()) {}
doesn't work because $calc = (float)123
.
also tried this-
if($calc == round($calc)) { die('is integer'); } else { die('is float); }
but doesn't work because returns in every case 'is float'
. in case above should'n true because 123 same 123 after rounding.
Comments
Post a Comment