Using Comments

Due to their shared inheritance from the C programming language, PHP and JavaScript share many similarities, one of which is commenting. First there’s the single line comment, like this:

// This is a comment

This style uses a pair of forward slash characters (//) to inform JavaScript that everything following is to be ignored. And then you also have multiline comments, like this:

/* This is a section
   of multiline comments
   that will not be
   interpreted */

Here you start a multiline comment with the sequence /* and end it with */. Just remember that you cannot nest multiline comments, so make sure that you don’t comment out large sections of code that already contain multiline comments.

Get Learning PHP, MySQL, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.