Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialSam Katz
2,986 Pointshow do I remember how to do a multi-line comment in PHP?
the syntax is confusing. which one is which? ending and closing.
2 Answers
Rifky Nandiansyah
1,397 PointsHi There,
it's very simple to make multiline comment in PHP.
we start with /* symbol (slash and star), and close with */ symbol ( star and slash) like this
/* this is multiline comment in php all the text here will not be execute as php command */
hope this helpfull.
Alexander Davison
65,469 PointsA multiline comment starts with /* and then ends with */.
A regular comment can be made by either // or a # in front of text, but it can only support one line.
If you use a multiline comment, use can make a comment that's as many lines as you want.
Here's examples of a regular comment:
// A comment
# A comment
However, If you try to extend the comment to multiple lines, it will fail:
# Comment
Not part of the comment
But, you can fix that with multiline comments (just remember to close the comment so it wouldn't comment out your code!):
/* Comment
Extended to two lines! :)
Cool! I can add as many lines as I want to,
as long as I end it.
*/
I hope this helps! ~Alex