Practice mode PHP

What is the output of the PHP statement echo str_repeat(“ab”, 3);?

Correct answer D. ababab

Explanation

str_repeat() returns the input string repeated the given number of times, so "ab" repeated three times becomes "ababab" with no spaces added.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.