Monday, 29 September 2014

str_repeat in PHP

PHP str_repeat() function is utilized to repeat a input string for certain number of times.

Syntax:

str_repeat(string,repeat)
string : Required.Specifies the input string

repeat : Required. Specifies the how many times the string will be repeated. Must be greater than or equal to 0

Example:

<?php
echo str_repeat("Good Morning, ",3);
?>
Output will be:
Good Morning, Good Morning, Good Morning,

0 comments:

Post a Comment