通过把值插入到模板中来建立一个格式化的字符串.
输入一个例子以见一般:
$string = 'Hello';
for($i=0;$i<strlen($string);$i++) {
printf("The %dth character is %s/n",$i,$string{i});
}
输出结果:
The 0th character is H
The 1th character is e
The 2th character is l
The 3th character is l
The 4th character is o
输入一个例子以见一般:
$string = 'Hello';
for($i=0;$i<strlen($string);$i++) {
printf("The %dth character is %s/n",$i,$string{i});
}
输出结果:
The 0th character is H
The 1th character is e
The 2th character is l
The 3th character is l
The 4th character is o