PHP 7.4.8 Released!


任何 PHP 脚本都是由一系列语句构成的。一条语句可以是一个赋值语句,一个函数调用,一个循环,一个条件语句或者甚至是一个什么也不做的语句(空语句)。语句通常以分号结束。此外,还可以用花括号将一组语句封装成一个语句组。语句组本身可以当作是一行语句。本章介绍了各种语句类型。

add a note add a note

User Contributed Notes 1 note

Hayley Watson
8 days ago
Statements "usually" end with a semicolon. In particular, statements that are statement-groups end with the "}", and a closing "?>" is also enough to end a statement (and turn off parsing, of course).

Writing "};" is wrong and can lead to bugs because now there's one of those "empty" statements in there that could potentially mess with control flow.
To Top