string sprintf ( string $format [, mixed $args [, mixed $... ]] )
它用于格式化字符串
Sr.No | 参数 & 描述 |
---|---|
1 |
format 它指定字符串以及如何在其中格式化变量 |
2 |
arg1 它指定要插入格式化字符串中的第一个参数 链接:https://www.learnfk.comhttps://www.learnfk.com/php/php-function-sprintf.html 来源:LearnFk无涯教程网 |
3 |
arg2 它指定要插入格式化字符串中的第二个参数 |
它返回格式化的字符串
<?php $number=123; $txt=sprintf("%f",$number); echo $txt; ?>
输出应如下所示
123.000000
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)