This article mainly introduces the detailed explanation of alternative syntax in PHP. Interested friends can refer to it. I hope it will be helpful to everyone.
What is alternative syntax?
Simply put, they are some alternative ways of writing grammar.
#2. What syntaxes have alternative syntaxes in PHP?
if, while, for, forforeach, switchThese flow control statements have alternative syntax.
3. Basic form of alternative syntax:
The left curly brace ({) is replaced by a colon (:), and the right The curly braces (}) are replaced with endif;, endwhile;, endfor;, endforeach; and endswitch;
Usage:
if-endif usage:
while-endwhile usage:
for-endfor usage:
switch-endswitch usage:
Related recommendations:
Introduction to alternative syntax in PHP, introduction to PHP alternative syntax_PHP tutorial
##Introduction to alternative syntax in PHP, introduction to PHP alternative syntax
The above is the detailed content of Detailed explanation of alternative syntax in PHP. For more information, please follow other related articles on the PHP Chinese website!