03.22
PHP as well as most (all?) other programming languages provide different ways to comment source code.
Most common comment indicators are # , // and /* */ .
1 2 3 4 5 6 | # this is a comment echo 'print something'; // another comment phpinfo(); /* and one more */ var_dump($_ENV); |
Which one should I use?
# vs //
I definitely tend to # since it’s only one character instead of two slashes.
# and // vs. /* */
If you plan to pack your code I would highly recommend to always use /* */ due to it’s source code packer compatibility.
/* */ also provides multi line commenting.
1 2 3 4 5 | /**
* this
* is a
* valid comment
**/ |
So long,
JaZz
No Comment.
Add Your Comment