How can I repeat a string variable several times?
Solution: use the str_repeat function of course! Just tell it what you want to repeat and how many times and it'll do the work for you, like so:
<?php
$bemine = "I love you lots ";
echo "$bemine" . str_repeat("and LOTS ",10);
?>
Giving us this touching declaration:
I love you lots and LOTS and LOTS and LOTS and LOTS and LOTS and LOTS and LOTS a
nd LOTS and LOTS and LOTS
Comment on this Question and Answer >>>
ASK A QUESTION
More strings PHP Questions
How do you hash the password in this php script: define(sb db user name, admin store); define(sb db password, mypassword);How do I replace a word in a string in PHP?
How do I reverse a string in PHP?
How do I find the ASCII value of a string character?
How do I turn a string into an array?
