Bifalgorithm post · Computer science one · Entry Point & Command Line Arguments

How are single-line and multiline comments handled in PHP?

How are single-line and multiline comments handled in PHP? (Computer science one · Entry Point & Command Line Arguments) — "37. Basics slashes is ignored. With…

Ideas in this flowchart

  • Comments in code are ultimately ignored by the interpreter.
  • Single-line comments begin with //.
  • Multiline comments begin with /* and end with */.
  • Everything between the multiline comment delimiters is ignored.
  • The example shows comments on separate lines, after code, and across multiple lines.
  • Code editors and IDEs distinguish comments with a special color or font.
  • Failing to close a multiline comment will likely cause a fatal interpreter error.
  • Color coding makes an unclosed multiline comment easier to detect visually.
Feed/

How are single-line and multiline comments handled in PHP?

No cover

Channel

Computer science one

1 page

"37. Basics slashes is ignored. With a multiline comment, everything in between the forward slash/asterisk is ignored. Comments are ultimately ignored by the interpreter. Consider the following example. 1 //this is a single line comment 2 $x = 10; //this is also a single line comment, but after some code 3 4 /* 5 This is a comment that can 6 span multiple lines to format the comment 7 message more clearly 8 */ 9 $y = 3.14; Most code editors and IDEs will present comments in a special color or font to distinguish them from the rest of the code (just as our example above does). Failure to close a multiline comment will likely result in a fatal interpreter error but with color-coded comments its easy to see the mistake visually."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.