diff --git a/content/php/concepts/string-functions/terms/str-repeat/str-repeat.md b/content/php/concepts/string-functions/terms/str-repeat/str-repeat.md new file mode 100644 index 00000000000..b39cfd9877d --- /dev/null +++ b/content/php/concepts/string-functions/terms/str-repeat/str-repeat.md @@ -0,0 +1,41 @@ +--- +Title: 'str_repeat()' +Description: 'Returns a string with occurrences of a specified substring repeated a specified number of times.' +Subjects: + - 'Computer Science' + - 'Web Design' + - 'Web Development' +Tags: + - 'Strings' + - 'Functions' +CatalogContent: + - 'learn-php' + - 'paths/computer-science' +--- + +The `str_repeat()` function returns a string that repeats a substring a specified number of times. + +## Syntax + +```pseudo +str_replace($string, $repeat) +``` + +- `$string`: Specifies the string to repeat and it is required. +- `$repeat`: Specifies the number of times the string will be repeated. Must be greater or equal to 0 and it is also required. + +## Codebyte Example + +This example provides a few demonstrations of `str_repeat()` operating on a string. + +> **Note:** The third echo statement will not output to the console due to the second argument of `str_repeat` being set to `0`. + +```codebyte/php + +```