Зміст курсу
Introduction to PHP
Introduction to PHP
Comments in PHP
Usage of Comments
Developers often need tools to make their code easier to understand, both for themselves and for the people they work with. Comments are one such tool, as they allow us to explain parts of the code. The PHP interpreter ignores comments, so they don't affect the execution of the program. Comments can be used for:
1. Explaining what the code does:
index
The comment above clearly indicates to us what exactly this code does.
2. Commenting out code blocks to avoid errors at runtime:
main
The comment above clearly demonstrates that the commented lines of code are ignored and do not affect the code execution result.
Single-Line and Multi-Line Comments
A single-line comment starts with //
and continues to the end of the line:
main
A multi-line comment starts with /*
and ends with */
. It can span multiple lines:
main
Все було зрозуміло?