For conditional rounding off ie. show decimal where it's really needed otherwise whole number
123.56 => 12.56
123.00 => 123
$somenumber = 123.56;
$somenumber = round($somenumber,2);
if($somenumber == intval($somenumber))
{
$somenumber = intval($somenumber);
}
echo $somenumber; // 123.56
$somenumber = 123.00;
$somenumber = round($somenumber,2);
if($somenumber == intval($somenumber))
{
$somenumber = intval($somenumber);
}
echo $somenumber; // 123