function test_loop($x_values,$x, $y)
{
$x = $x + 1;
if($x < 4)
{
//I want to add $x value into $x_values variable, eg : $x_values = $x_values . $x
Why don't you try to make $x_values
an array, and add values in $x_values
as array items, $x_values[] = $x;
and then when you're ready, just implode() those values into a string. Like this:
function test_loop($x_values,$x, $y)
{
$x = $x + 1;
if($x < 4)
{
$x_values[] = $x;
}
//loop again if y is not = 3;
$y = $y + 1;
if($y < 3)
{
echo "kkk" . $y . "<br/>";
$x_values[] = $x;
}else{
echo "---------------------<br/>";
}
return implode($x_values);
}
Just make sure that you also pass $x_values
as an array initially:
function abc(){
$bababa = test_loop([0],1,0);
echo $bababa;
}