I have a PHP script with a while loop and I need to return the result as a single variable !
Code schema :
$count = "0";
while($count < "4")
{
echo $count;
$count = $count + "1";
}
It will return : 0123, What I want to have a variable with the value : 0123
I also tried :
$count = "0";
while($count < "4")
{
$result .= $count;
$count = $count + "1";
}
echo $result;
But it will show the result like : 0010120123
I know I can use array to get all results outside the loop, but I want to have all results as a single variable but not in an array !
Update : I found the problem :S stupid mistake ! I used :
echo $result
Inside my loop :S So
$result .= $count;
Work fine :)