是否有一个函数将在PHP中打印指定数量的空格?
下面是ASP的相应示例:
Dim txt
txt=Space(10)
document.write(txt)
Output:
" "
是的,str_repeat
就是你想要的。
函数
<?php
echo str_repeat("x", 10);
?>
将输出
xxxxxxxxxxx
使用
echo str_repeat(" ", 10);
是否有一个函数将在PHP中打印指定数量的空格?
下面是ASP的相应示例:
Dim txt
txt=Space(10)
document.write(txt)
Output:
" "
是的,str_repeat
就是你想要的。
函数
<?php
echo str_repeat("x", 10);
?>
将输出
xxxxxxxxxxx
使用
echo str_repeat(" ", 10);