From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Adding comments to PHP scripts

Adding comments to PHP scripts - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Adding comments to PHP scripts

It doesn't matter how experienced you become at writing php or any other type of code. When you come back to a script several months later, the meaning won't always be obvious. So it's useful to add comments to remind you what the code was for. Comments are also a useful way of disabling parts of a script when troubleshooting problems. PHP has three different styles of comments. Two of them are the same as in JavaScript, so let's deal with them first. And to make it a little bit easier to see where the comments are, I'm going to reorganize the script in this page so the PHP is on a beginning of a line. Just move that. The first style of comment is anything between two forward slashes and the end of the line. Is treated as a comment and ignored by the php engine. So, after this echo stringtoupper city I'm going to add a comment. I type in two forward slashes. And I'm using Dream Weaver as my editor. You can see that it's already changed the color to orange. That's syntax highlighting…

Contents