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 trial

PHP

PHP brackets

i am a bit confused as to why is there two different ways to use the brackets in PHP. why would you use example 1 vs example 2?

example 1

<?php   //some code    { ?>

// code body

<?php } ?>

-vs-

example 2

<?php   //some code    { 

// code body

 } 
 ?>

2 Answers

Randy Hoyt
STAFF
Randy Hoyt
Treehouse Guest Teacher

Great question. That's one thing I'm working to clarify in the videos: sorry for the confusion! I answered this question for someone in a previous thread. Take a look at that thread and my response:

Does that help?

Thanks Randy, That helped me understand the difference.