Comments in php
PHP is unique in that if offer several ways to comment code. There are 2 options for single-line commenting, and another option for multi-line commenting.
Single-line comments in PHP
There are two different ways to insert single-line comments in PHP. One is based on the Unix style for shell scripts, while the other is based on comments in the C++,Java programming environment.
Which style should you use? Technically speaking, there’s really no benefit or drawback to either. It’s simply a matter of preference.
Multi-line comments in PHP
What if you want to insert a large block of text that shouldn’t be interpreted as code or displayed on screen? This is the perfect opportunity to utilize a multi-line comment. Just like the 2 single-line comment styles, PHP’s multi-line comment is derived from another programming language like Java
PHP is unique in that if offer several ways to comment code. There are 2 options for single-line commenting, and another option for multi-line commenting.
Single-line comments in PHP
There are two different ways to insert single-line comments in PHP. One is based on the Unix style for shell scripts, while the other is based on comments in the C++,Java programming environment.
<?php # This is a comment in PHP using the Unix style //This is a comment in PHP using the C++,Java style ?>
Which style should you use? Technically speaking, there’s really no benefit or drawback to either. It’s simply a matter of preference.
Multi-line comments in PHP
What if you want to insert a large block of text that shouldn’t be interpreted as code or displayed on screen? This is the perfect opportunity to utilize a multi-line comment. Just like the 2 single-line comment styles, PHP’s multi-line comment is derived from another programming language like Java
<?php /* This is a multi-line comment in PHP. The style for mult-line comments in PHP is derived from the Java programming language. Like all comments, none of this will be displayed on screen. */ ?>
0 comments:
Post a Comment