php .com
var;
}
}
?>
php .com
Regarding earlier note by @purkrt :
> I would like to stress out that the opening tag is "
would not work, as mentioned, but :
will work, as well as :
and :
I just wanted to clarify this to prevent anyone from misreading purkrt's note to mean that a the opening tag --even when being on its own line--required a space ( \s ) character. The following would work but is not at all necessary or how the earlier comment should be interpreted :
The end-of-line character is whitespace, so it is all that you would need.
php .com
This is going to be ignored by PHP and displayed by the browser.
This will also be ignored by PHP and displayed by the browser.
php .com
", are always available." since PHP 7.0.0 is no longer true. These are removed along the ASP "<%, %>, <%=" tags.
php .com
One aspect of PHP that you need to be careful of, is that ?> will drop you out of PHP code and into HTML even if it appears inside a // comment. (This does not apply to /* */ comments.) This can lead to unexpected results. For example, take this line:
' . "\n";
?>
If you try to remove it by turning it into a comment, you get this:
' . "\n";
?>
Which results in ' . "\n"; (and whatever is in the lines following it) to be output to your HTML page.
The cure is to either comment it out using /* */ tags, or re-write the line as:
' . "\n";
?>
php .com
Notes can come in all sorts of shapes and sizes. They vary, and their uses are completely up to the person writing the code. However, I try to keep things consistent in my code that way it's easy for the next person to read. So something like this might help...
php .com
Comments do NOT take up processing power.
So, for all the people who argue that comments are undesired because they take up processing power now have no reason to comment ;)
"; // 0.25163600 1292450508
echo microtime(), " "; // 0.25186000 1292450508
// Test
echo microtime(), " "; // 0.25189700 1292450508
# TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST TEST
# .. Above comment repeated 18809 times ..
echo microtime(), " "; // 0.25192100 1292450508
?>
They take up about the same amount of time (about meaning on a repeated testing, sometimes the difference between the control and the test was negative and sometimes positive).
php .com
Comments in PHP can be used for several purposes, a very interesting one being that you can generate API documentation directly from them by using PHPDocumentor (http://www.phpdoc.org/).
Therefor one has to use a JavaDoc-like comment syntax (conforms to the DocBook DTD), example:
* in your development cycle save you a lot of time by preventing you having to rewrite
* major documentation parts to generate some usable form of documentation.
*/
?>
Some basic html-like formatting is supported with this (ie tags) to create something of a layout.
|