什么是“:"在 PHP 中?

2021-12-29 00:00:00 syntax php

符号 : 在 PHP 中是什么意思?

What does the symbol : mean in PHP?

推荐答案

PHP 为其某些控制结构提供了替代语法;即,if、while、for、foreach 和 switch.在每种情况下,替代语法的基本形式是分别将左大括号更改为冒号 (:),将右大括号更改为 endif;、endwhile;、endfor;、endforeach; 或 endswitch;.

PHP offers an alternative syntax for some of its control structures; namely, if, while, for, foreach, and switch. In each case, the basic form of the alternate syntax is to change the opening brace to a colon (:) and the closing brace to endif;, endwhile;, endfor;, endforeach;, or endswitch;, respectively.

相关文章