if-then-else_替代的if-then-else语法

if-then-else_替代的if-then-else语法

if-then-else

There's a small error in the PHP certification guide in the alternative if-then-else syntax code.

PHP认证指南中的if-then-else替代语法代码中有一个小错误。

This alternative syntax goes like: < ?php if (true) : echo 'it is true'; else : echo 'so not true'; endif; ?>

这种替代语法如下:<?php if(true):echo'它是真的'; else:回声“所以不是真的”; 万一; ?>

In the example given in the cert guide, the ; after endif is missing, which will cause a parse error.

在证书指南中给出的例子中, ; endif丢失后,将导致解析错误。

Tell your friends about this post on Facebook and Twitter

FacebookTwitter上告诉您的朋友有关此帖子的信息

翻译自: https://www.phpied.com/alternative-if-then-else-syntax/

if-then-else