Repeating String str_repeat function

echo str_repeat('$',10);
The above command will print $ ten times.
$$$$$$$$$$
Syntax.
str_repeat (input $string, int $multiplier );
ParameterDESCRIPTION
$stringRequired : Input string which is to be repeated
$multiplierRequired : Integer , Number of times the input string is to be repeated.
Using str_repeat string function we can repeat a string by a number ( known as multiplier ).

We will generate this pattern ?

*
**
***
****
*****
******
*******
********
*********
**********

Here is the code for this
for($i=1;$i<=10;$i++){
echo str_repeat("*",$i);
echo "<br>";
}

String Functions str_pad(): Padding string nl2br() To add Line break
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Post your comments , suggestion , error , requirements etc here





    PHP video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer