How to return string that extended by recursive loop in a php function?

hi @2aek1987 and a warm welcome you the forum.

Try adding the following and see what is happening:

 $x = $x + 1;
echo $x;
echo ' ==> ' .$string_name .'<br>'; // line feed