Question from the PHP - Fundamentals test

Write a function in PHP that repeats a string a given number of times.

Easy

What is the output of the following code ?

function repeat($s, $n) {
	$c = "ba";
	for ($i = 0; $i < $n; $i++) {
		$c .= $s;
	}
	return $c;
}
echo repeat("na", 3);
Author: ThéoStatus: PublishedQuestion passed 141 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!