How to str_repeat Function works?

  April 23,2010   Read: 944 Times

Introduction:

Returns input_str repeated multiplier times. multiplier has to be greater than or equal to 0. If the multiplier is set to 0, the function will return an empty string.

Function usages & Parameters:

string str_repeat ( string input, int multiplier )

Example:

str_repeat() example:

echo str_repeat("-",20);
echo('<br>');
echo str_repeat("==",20);
echo('<br>');
echo str_repeat("=*=",15);

The above example will output:

--------------------
========================================
=*==*==*==*==*==*==*==*==*==*==*==*==*==*==*=

Was this information useful? What other tips would you like to read about in the future? Share your comments, feedback and experiences with us by commenting below!

  You might also like...

  String encoding and decoding functions in php: Day#5

  How to str_replace Function work?

  How to substr function works?

  vfprintf function in php

  How to strripos function works?

Share:

  Author: Md Mahbub Alam Khan (255 Posts)

Md Mahbub Alam Khan is the Editor and Founder of CoolAJAX Web Blog. You can follow CoolAJAX on Twitter , on Facebook or you can subscribe via RSS .

Write For Us & Be An Exclusive Post Author!

comments powered by Disqus