- if (expression):
- ?>
- statement
- endif
- ?>
-
Copy code
The above writing method is an alternative syntax for PHP process control.
There are several alternative syntaxes in PHP flow control:
if,while,forforeach,switch
The basic form of the alternative syntax is:
Replace the opening brace ({) on the left side of the flow control statement with a colon (:), and the closing brace (}) on the right side can be replaced with endif or endwhile or endfor or endforeach or even endswitch.
|