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.
views:
78answers:
6What’s the reason for the down vote?
Gumbo
2010-09-06 12:32:20
i tried to keep a nice votes sequence 6..1 in this thread, but since that didn't work, here's your point back. ;)
stereofrog
2010-09-06 14:42:22
+4
A:
$var = 'z';
$i = 5;
$var = str_repeat($var, $i);
echo $var; // zzzzz
BoltClock
2010-09-06 11:38:03
+3
A:
<?php echo $x = str_repeat("x", 5); // "xxxxx" // Hope it helps, one row ;)
edorian
2010-09-06 11:38:14
+2
A:
Use
str_repeat(String, Multiplier);
EDIT: Wow am I slow ...
Octavian Damiean
2010-09-06 11:40:18
+1
A:
try str_repeat (this should be upvoted once to maintain the sequence)
stereofrog
2010-09-06 12:16:26