website creator Method to remove or strip trailing zeros of a decimal number:
function clean_num( $num ){ $pos = strpos($num, '.'); if($pos === false) { // it is integer number return $num; }else{ // it is decimal number return rtrim(rtrim($num, '0'), '.'); } }
Works on numbers: 0.02=0.02; 4.000=4; 80=80.
With little addition works even with 1.000.00,00 Nice idea with the rtrim(rtrim($num, '0'), '.');
sorry abt that - vote , this script works well.