Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP When are you supposed to use endif to end the conditional statement?

Have Programming Question? Ask it here!
 
 
 


brijesh
When are you supposed to use endif to end the conditional statement?
1 Answer(s)      3 years and 10 months ago
Posted in : PHP


When are you supposed to use endif to end the conditional statement?


Advertisement
View Answers

November 15, 2010 at 11:33 AM


Hi all,

When the original if was followed by : and then the code block without braces.

Example:

<?php
if ($username == "deepak"):
    echo "User Name is deepak.";
elseif ($username == "kumar"):
    echo "User Name is kumar.";
else:
    echo "wrong user name";
endif;
?>

Thanks



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com