<?php
$num=10;
$thestr="a";
for ( $i=1; $i<=$num-1; $i++){
$thestr=$thestr."a";
}
echo $thestr;
?>
$num=10;
$thestr="a";
for ( $i=1; $i<=$num-1; $i++){
$thestr=$thestr."a";
}
echo $thestr;
?>
$num=10;
$thestr="a";
for ( $i=1; $i<=$num-1; $i++){
$thestr=$thestr."a";
}
echo $thestr;
?>这么写是对的,我试了一下,好几天没用php了,害得我还把apache重启了一下。结果结果是正确的
str_repeat("a", 3);
$num=10;
$thestr="a";
for ( $i=1; $i<=$num-1; $i++)
$thestr=$thestr."a";
echo $thestr;
?>
与
<?php
$num=10;
$thestr="a";
for ( $i=1; $i<=$num-1; $i++){
$thestr=$thestr."a";
}
echo $thestr;
?>
有区别吗?