In PHP, the printf()
function is used to format and print output. It allows you to specify a format string and a variable number of arguments that will be inserted into the format string. Here's an example:
$name = "John";
$age = 25;
printf("My name is %s and I am %d years old.", $name, $age);
Output:
My name is John and I am 25 years old.
In the example above, %s
is used to insert the value of $name
as a string, and %d
is used to insert the value of $age
as a decimal number. The order of the arguments in the printf()
function must match the order of the placeholders in the format string.
上一篇:php安装软件(PHP软件下载)
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站