elseifで、さらなる条件の処理を行う。
1なら"One!"、2なら"Two!"、それ以外なら"Other!"。
<html> <head> <title>elseif</title> </head> <body> <?php $var = 1; ?> <?php if ($var == 1){ ?> One! <?php } elseif($var == 2){ ?> Two! <?php } else{ ?> Other! <?php } ?> </body> </html>
なら、
One!。
<html> <head> <title>elseif</title> </head> <body> <?php $var = 2; ?> <?php if ($var == 1){ ?> One! <?php } elseif($var == 2){ ?> Two! <?php } else{ ?> Other! <?php } ?> </body> </html>
なら、
Two!。
なら、
Other!。
Sample/php/elseif/elseif/src/elseif at master · bg1bgst333/Sample · GitHub