Adding Comments to PHP Code

Code that seems clear at the time of writing can seem like a hopeless tangle when you try to amend it six months later. Adding comments to your code as you write can save you time later on and make it easier fo other programmers to work with your code.
A comment is a text in a script that is ignored by the PHP engine. Comments can be used to make the code more readable or to annotate a script.
Single-line comments begin with two forward slashes (//) or
a single hash sign(#).
The PHP engine ignores all text between these marks and either the end of the line or the PHP close tag:
// this is a comment
# this is another comment
Multiline comments begin with a forward slash followed by an asterisk (/*) and end with an asterisk followed by a forward slash (*/):
this is a comment none of this will be parsed by the PHP engine

Recommended Tutorials for you


Anuj kumar

This is Anuj Kumar. I’m a professional web developer with 5+ years of experience. I write blogs in my free time. I love to learn new technologies and share with others. I founded PHPGurukul in September 2015. The main aim of this website to provide PHP, Jquery, MySQL, PHP Oops and other web development tutorials. .


  1. Hello Sir,
    please am having issue in uploading “Hostel management” to my site,
    after created of database did not display any data from database

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Check Also
Back to top button