Alternative to money_format() Function in PHP on Windows Platform

前端 未结 13 1927
天命终不由人
天命终不由人 2020-12-01 09:02

I am using the money_format() function in PHP, which gives the following error:

Fatal error: Call to undefined function money_format()
         


        
13条回答
  •  一生所求
    2020-12-01 09:49

     3) ? $j % 3 : 0; 
    
       return  $symbol.$sign .($j ? substr($i,0, $j) + $t : '').preg_replace('/(\d{3})(?=\d)/',"$1" + $t,substr($i,$j)) ;
    
    }
    
    echo toMoney(9856478521456.256);
    ?>
    

    try this the out put of above code is "$9,856,478,521,456.26"

提交回复
热议问题