if..endif syntax<br />
The `alternative' way to write if/elseif/else statements, using if(); elseif(); else; endif; cannot be efficiently implemented without adding a large amount of complexity to the 3.0 parser. Because of this, the syntax has been changed: Example E-5. Migration: old if..endif syntax<br />
<br />
if ($foo);<br />
echo "yep\n";<br />
elseif ($bar);<br />
echo "almost\n";<br />
else;<br />
echo "nope\n";<br />
endif; <br />
<br />
Example E-6. Migration: new if..endif syntax<br />
<br />
if ($foo):<br />
echo "yep\n";<br />
elseif ($bar):<br />
echo "almost\n";<br />
else:<br />
echo "nope\n";<br />
endif; <br />
<br />
Notice that the semicolons have been replaced by colons in all statements but the one terminating the expression (endif). <br />
<br />
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn