PHP字符串问题

HI all I have an issue, let say I have $var="z" and how to concatenate the z $i times, for example if $i==5 then $var should be "zzzzz". BTW I would need this in one row.

Use str_repeat:

$repeated = str_repeat($var, $i);

With this $var is repeated $i times.

You use str_repeat. In your case:

str_repeat($var, $i);
<?php echo $x = str_repeat("x", 5); // "xxxxx" // Hope it helps, one row ;)

Use

str_repeat(String, Multiplier);

EDIT: Wow am I slow ...

try str_repeat (this should be upvoted once to maintain the sequence)