This is the function for formatting FLOAT number as INT if decimal part is 0.
$formatted = (int)$i + $i - (int)$i;
// $i = 15.12 , $formatted = 15.12
// $i = 15.00 , $formatted = 15
But it seems to be a bug in PHP. I hadn't found type cast for INT+FLOAT operation in PHP manual. In other language, like C++ INT+FLOAT = FLOAT.