[英]A question about ; in PHP
exit()
is valid,but 有效,但是
exit()
echo 1;
Will fail. 将失败。
Why? 为什么?
分号可以终止一条语句,尽管如果是最后一条语句则不需要。
The first is correct syntax , the later isn't. 第一个是正确的语法,第二个则不是。 If more than one command is provided, they have to be separated via
;
如果提供了多个命令,则必须通过
;
分隔它们;
. 。
echo 1
wouldn't be executed anyway. 无论如何,将不会执行
echo 1
。
This: 这个:
exit()
will work only if it is at the end 只有在结尾时才能工作
But 但
exit()
echo 1;
In this case it is not on the end. 在这种情况下,它还没有结束。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.