In this tutorial on “how to block PHP code”, we will guide you how to block PHP code in multiple ways through multiple methods. A blocked code is a part of the PHP script which is ignored in the execution. A block of code can be blocked by commenting it. Code can be blocked using multi-line commenting or by single line commenting. A comment in a PHP code is a line which is ignored and is not considered as the part of the execution. Normally, Programmers provide a description of the functions and variables below their code to make it understandable to the other programmers. The description is commented i.e. blocked so that it does not generate errors.
Step #1 – Block a block of code
In order to comment a block of code, the code is enclosed within a slash along with an asterisk. These tags simply block the code which is included in them.
Step #2 – Block a single line using double slash
In order to block a single line of PHP code, we have to place two slashes at the start of the line.
Step #3 – Block a single line using hash
Another method to block a single line of PHP code is to add a number sign at the start of the line.
And that was all about to block php code.