RsD0p9BK
5/4/2015 - 6:42 AM

num_format__not_zero.php

// number_format only if not zero

$num = 100.1;
echo (floor($num) == $num) ? $num : number_format($num,1);

// http://www.ciiycode.com/0mzSBWjeexjW/numberformat-only-if-not-zero