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

java - Ebean enhancement ignores a model -

ubuntu - How to disable Kernel Module Signing in linux -

SQL php on different pages to Insert (mysqli) -