09.07.2015, 19:19
Get rid of "else if" wherever possible. You should never need to use that construct. If you keep the rule in mind that "else should alway be on its own" then you will have far less problems.
Can and should be restructured like:
And then you'll notice what a horrible mess the code really is.
PHP код:
if
{
// 1
}
else if
{
// 2
}
else
{
// 3
}
PHP код:
if
{
// 1
}
else
{
if
{
// 2
}
else
{
// 3
}
}