<?php$number = 1234.56;// english notation (default)
$english_format_number = number_format($number);
// 1,235// French notation
$nombre_format_francais = number_format($number, 2, ',', ' ');
// 1 234,56$number = 1234.5678;// english notation without thousands seperator
$english_format_number = number_format($number, 2, '.', '');
// 1234.57?> 

解决方案 »

  1.   


    $dd = 1.44444444444444444444445;
    function d($str)
    {
    if(strlen($str)>4)
    {
    $str = strval(round($str,3));
    echo round($str,2)+0.01;
    }
    else
    echo $str;
    }
    d($dd);
      

  2.   


    $dd = 1.44444444444444444444445;
        function d($str)
        {
            if(strlen($str)>4)
            {
            //$str = strval(round($str,3));这句多余
            echo round($str,2)+0.01;
            }
            else
            echo $str;
        }
        d($dd);
      

  3.   

    我不是用来显示的,是用来计算机的比如 $a 可能等于1.4444444...5 , 也可能等于1.444444444...4如果你不加0.01,那么当$a 是 1.444444444..5时,得出来的就是1.44,不是1.45如果加0.01 ,那么当$a是1.444444444...4时,得出来的是1.45 而不是1.44所以说这两种方法是错误的,不知我说的你们清楚不
      

  4.   

    我看 .net 可以做到呀~  所以想问一下PHP 行不~