【发布时间】:2013-05-20 13:28:30
【问题描述】:
我想重复特殊字符或制表符。
我尝试使用 str_repeat(str, int)
//my function repeat
function tab($num){
return str_repeat('	', $num);
}
//if I call
echo '<table>' . "\r\n";
echo tab(3) . '<tr>';
//the result
<table>
			<tr>;
我尝试了几种使用单引号和双引号的方法, 但结果总是错的
【问题讨论】:
-
有什么问题?尝试在它们后面添加
&nbsp;。 -
问题是你为什么要做这样的事情?
-
@Rikesh 修饰我代码中的缩进,使其看起来更具可读性。
-
使用 \t 打印标签
-
你使用的是浏览器还是cli输出?
标签: php ascii special-characters repeat