Strings In Depth8 / 18
Up next

Repeat a string

<?php
declare(strict_types=1);
// repeat a single character
echo str_repeat("=", 10), "\n";
// repeat a longer chunk
echo str_repeat("ab", 3), "\n";
What you're solving

str_repeat builds runs of copies