php - Is IF obligatory to be followed by ELSE -


i not sure if if must followed else in example above or if if can used alone without else. page show if there no else? beginner...

<?php $rank = $user["rank"]; if ($rank != 'admin'){     header('location: get_the_he.._out.php');     exit();     } else {  ?> <html> <head><title>show page</title></head>  <body>  here show page if user admin  </body> </html>  <?php } ?> 

no. there no need have else if. need make sure script not continue after if, doing here :)


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -