[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
PHPComments
Below, the different ways to use comments in PHP are shown. (For those C/C++ people, this should look pretty familiar)
The thing not to forget is, that the behaviour of the comment-tags is different: The /* comment */ can be spanned along several lines, it is not necessary to end each line with a */. Otherwise, the //comment - tag makes the parser leave the actual line unscanned from the // to the end of the line, so a multiline-comment would require a new // each line. The #-tag is used similar.
As you can see there are three ways to comment stuff in PHP. The preferred PHP method is using two backslashes, but feel free to use any method shown. Remember, commenting your code is a good thing!
Back to the PHP section
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
PHPComments
Using Comments
Comments are a crucial thing for programmers. Often there are times where a programmer will code something, leave a company, and then the new guy has to try and understand what the programmer before him was trying to do. Or, you coded something 3 years ago and are re-visiting it again. However, you aren't sure why you did dummy = temp + dummy / temp * dummy; By using comments these problems can be avoided.Below, the different ways to use comments in PHP are shown. (For those C/C++ people, this should look pretty familiar)
The thing not to forget is, that the behaviour of the comment-tags is different: The /* comment */ can be spanned along several lines, it is not necessary to end each line with a */. Otherwise, the //comment - tag makes the parser leave the actual line unscanned from the // to the end of the line, so a multiline-comment would require a new // each line. The #-tag is used similar.
<?php
/*
All this text will
be commented out because
this is a block comment
- /
- this is another way commenting in PHP..resembles Perl
As you can see there are three ways to comment stuff in PHP. The preferred PHP method is using two backslashes, but feel free to use any method shown. Remember, commenting your code is a good thing!
Back to the PHP section
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
