function restyle_text($input){
$input = number_format($input);
$input_count = substr_count($input, ',');
if($input_count != '0'){
if($input_count == '1'){
return substr($input, +4).'k';
} else if($input_count == '2'){
return substr($input, +8).'mil';
} else if($input_count == '3'){
return substr($input, +12).'bil';
} else {
return;
}
} else {
return $input;
}
}
這是我的代碼,我認爲它工作。顯然不是......可以有人幫助,因爲我無法弄清楚這一點。顯示1k而不是1,000
當您運行此代碼時,您收到了什麼?你有沒有收到任何錯誤?如果是,那麼哪個? – Lion 2011-12-18 02:42:52
這是做什麼,「不工作」? – 2011-12-18 02:43:04
可能重複[縮短長號到K/M/B?](http://stackoverflow.com/questions/4371059/shorten-long-numbers-to-kmb) – 2011-12-18 02:50:51