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