You need to use the return value inside the function, as well as outside it ...
test_loop($string_name,$x);
Does the work, but throws away the answer ...
Try this:
function test_loop($string_name,$x)
{
$x = $x + 1;
if($x < 10)
{
$string_name = test_loop($string_name . $x . "##", $x);
}
return $string_name;
}
$bababa = test_loop(0,1);