Is it possible in PHP echo
to have for loop
inside of it?
Something like this:
echo "This are the list" . for($i=0; $i<=$count; $i++) { echo $variable1 . $variable2} . "End";
My code goes like this.
but I still experience error.
Is it possible in PHP echo
to have for loop
inside of it?
Something like this:
echo "This are the list" . for($i=0; $i<=$count; $i++) { echo $variable1 . $variable2} . "End";
My code goes like this.
but I still experience error.
Nope it's not going to work like that.
You have two options.
$temp_string = '';
for ($i=0; $i<=$count; $i++)
{
$temp_string .= $variable1 . $variable2;
}
echo "This are the list".$temp_string;
echo "This are the list";
for($i=0; $i<=$count; $i++)
{
echo $variable1 . $variable2;
}
echo "End";