How to comment out a piece of code in PHP?
In PHP, there are two ways to comment out a block of code.
- Single-line comments begin with // and continue until the end of the line. For example:
// 这是一行单行注释的示例
- Multiple-line comments: start with /* and end with */. For example:
/*
这是多行注释的示例
注释的内容可以跨越多行
*/
The commented code will be ignored by the PHP interpreter and will not be executed. This is very useful for debugging code, temporarily disabling code, or providing explanatory documentation.