Write a function that receives a string and a repeat count n. The function should return a new string:
Input:
Output:
abcabcabc
Input 2:
Output 2:
StringString
My PHP function solution:
<?php $string = readline(); $repeat = readline(); echo repeatString($string, $repeat); function repeatString($s, $r) { $newString = ''; for ($i = 0; $i < $r; $i++) { $newString .= $s; } return $newString; }
622 questions
979 answers
129 comments
53 users