函数名称:vprintf()
适用版本:PHP 4, PHP 5, PHP 7
函数描述:vprintf() 函数根据指定的格式和参数进行格式化输出。
用法: vprintf ( string $format , array $args ) : int
参数:
返回值: 返回成功输出的字符数。
示例:
// 示例1:
$number = 10;
$text = "hello";
vprintf("The number is %d and the text is %s", array($number, $text));
// 输出:The number is 10 and the text is hello
// 示例2:
$fruit = "apple";
$quantity = 5;
$price = 2.50;
vprintf("I bought %d %s(s) for $%.2f", array($quantity, $fruit, $price));
// 输出:I bought 5 apple(s) for $2.50
注意事项: