function test_loop($x_values,$x, $y)
{
$x = $x + 1;
if($x < 4)
{
$x_values = test_loop($x_values . $x . "##", $x, $y);
}
$y = $y + 1;
if($y < 3)
{
echo "kkk" . $y . "<br/>";
$x_values = test_loop($x_values . $x . "##", $x, $y);
}else{
echo "---------------------<br/>";
}
return $x_values;
}
function abc(){
$bababa = test_loop(0,1,0);
echo $bababa;
}
abc();
Output :
kkk1
kkk2
---------------------
kkk1
kkk2
---------------------
kkk1
kkk2
---------------------
kkk2
---------------------
02##3##4##5##3##4##2##3##4##3##
How to make the output become :
kkk1
kkk2
---------------------
02##3##
What I have tried:
Regarding the comment tag
I want to add value of $x into variable $x_values by this code :
$x_values = $x_values . $x;
but it is not working, so I force to use
$x_values = test_loop($x_values . $x . "##", $x, $y);
end up it keep calling test_loop(). How to add in value of $x into variable $x_values without calling the test_loop() function?