Jump to content

More than one ElseIf


Norman

Recommended Posts

Is possible to use more that one ElseIf? For example:if ($my_variable == 1) { echo "<p>My variable is equal to one.</p>"; } else if ($my_variable == 2) { echo "<p>My variable is equal to two.</p>"; } else if ($my_variable == 3) { echo "<p>My variable is equal to three.</p>"; } else { echo "<p>My variable is equal to neither one nor two nor three.</p>"; }

Link to comment
Share on other sites

Well, I think if you try that out, you'll find it is indeed possible. When you evaluate only one variable though, you could also use switch().

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...