$format = 'The %2$s contains %1$04d monkeys! %s apples.'; echo sprintf($format, 4, 'tree'); // output: The tree contains 0004 monkeys! 4 apples. // number_format(数字, 保留小数位数, 小数分割符='.', 千分位分隔符=','); $num = 1234.567; echo number_format($num); // 1,235 echo number_format($num, 2); // 1,234.57 echo number_format($num, 2, '.', ''); // 1234.57 echo number_format($num, 2, '_', ','); // 1,234_57
欢迎转载,转载请注明:转载自[ http://www.cnblogs.com/zjfree/ ]