寫了這麼久php,還是第一次看到endif endwhile這一種格式
(剛剛在查看某wordpress template時看到)
於是就google看看
原來這款格式是php3時候就有了,格式如下
if ($foo): echo "yep\n"; elseif ($bar): echo "almost\n"; else: echo "nope\n"; endif;
除此之外,還有endwhile / endswitch等等~
(想看詳細doc的,請到source中的php.net連結)
source:
http://www.phpbuilder.com/manual/en/migration.if-endif.php
http://docs.php.net/manual/control-structures.alternative-syntax.php
我也是在 wordpress 上的看到的,然后Google 就到了这里。