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 trialIkrom Rashidov
1,344 PointsHi all,
Why do we need the underscore for variable like this $email_body,what it is doing there?
thank you,
4 Answers
Ben Russell
3,667 PointsShort answer....you don't :) Provided you're not using a space a variable name can be anything.
Ikrom Rashidov
1,344 Pointsthank you but did not get it little, really short answer :)
Derrick Mull
18,518 PointsIt's just a naming convention for variables. Helps the code be more readable and have a cleaner appearance.
The $email_body variable could easily be used the same as:
$emailBody
$EmailBody
$emailbody
but never:
$email body
Without the underscore the variable would be broken.
Ikrom Rashidov
1,344 PointsThanks a lot Derrick really god explaining now I got it