• I don’t know the basics of how to “comment” in php files like my template files. Commenting in the code means writing a note to yourself, that doesn’t affect the code. It gets ignored.

    I’m often instructed by plugins or hints on the forum, to “comment” my changes, or “uncomment” some template tag (this is in the Default theme Kubrick).

    …You can put a slash before it? What about /* or */

Viewing 4 replies - 1 through 4 (of 4 total)
  • // makes only the line a comment.
    When using /*, the comment will end at */

    Thread Starter Dgold

    (@dgold)

    Thanks, that answers everything but what about line-wrap on the first one. Applies if it’s more than so-many characters…. or if you don’t press Enter? Example, I added some words to an existing // and it might spill over to the next line, a problem?

    PHP doesn’t care about long lines as long as it’s not a new line. Word wrapping done by your editor doesn’t affect PHP.

    However, if you do something like:


    // this should be a really long
    line but on a new line instead of continuation

    The above will fail because I used two line and not the long continuation of a single line.

    In general, it is BEST pratice to use the // operator on very small comments. Anything that might become a sentence, you shouold use /* and */.

    Regards

    Also, certain commenting standards are used by PHP programmers.
    I use docblocks, and you can read more about them at http://www.phpdoc.org/ . Basically you would use:

    // For one line comments

    and:

    /**
    * For comments of
    * more than one
    * line.
    */

    – Sean

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How do I “comment” in php files?’ is closed to new replies.