首页 > PHP教程 > PHP常用函数手册 > PHP String 函数

PHP printf() 函数

 函数原型

/**

 * 输出格式化的字符串

 * @link http://php.net/manual/en/function.printf.php

 * @param string $format  字符串以及如何格式化其中的变量

 * @param mixed $args [optional]  定义format字符串中第一个 % 符号处的参数

 * @param mixed $_ [optional]  定义format字符串中第二个及后面 % 符号处的参数

 * @return int  返回输出字符串的长度

 * @since 4.0

 * @since 5.0

 */

function printf ($format, $args = null, $_ = null) {}

 

函数示例

<?php

$name = "php";

printf("The language is %s.",$name);  //输出 The language is php.

?>

关闭
感谢您的支持,我会继续努力!
扫码打赏,建议金额1-10元


提醒:打赏金额将直接进入对方账号,无法退款,请您谨慎操作。