dimanche 2 juillet 2017

the correct way putting for loop inside if-else

What is the correct way putting for loop inside if-else

is it possible to do this ?

if()
{
for()
}
else
{
for()
}

example below i received syntax error, unexpected '}'

if ($year=$current_year)
{
for($m=1; $m<=$current_month; ++$m)
}
else
{
for($m=1; $m<=12; ++$m)
}   

or we must use it like this

if ()
{
 for()
 {}
}
else
{
for ()
{}
}

Aucun commentaire:

Enregistrer un commentaire