php: best way to assign 10 times the same symbol (space) to a variable

php, string

Solution

str_repeat():

$symbol = '_';
$num    = 10;
echo str_repeat($symbol, $num);

Problem

We have ``` $symb="_"; $num=10; ``` We want `$ten_symbs` to be exactly `"__________"; // ten symbols "_".` Whats the fastest and/or the best way to assign ten "_" to `$ten_symbs`?

Original source

Related problems