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 trialSeth Warner
5,348 Pointswriting it a cleaner, more efficient way?
Could you do this like CSS for php
<ul> <li> <?php echo $sum; echo $diff
?> </li> </ul>
Or do you have to close off each echo with its own <?php?> around it.
1 Answer
Shawn Gregory
Courses Plus Student 40,672 PointsSeth,
From what I am understanding of your question, if you want to, you can have a complete PHP script on just one line so long as you are separating the statements with a semicolon. It's not advisable as it will be hard to decipher later on by yourself or someone else. If you are asking if you can echo two variables on the same echo statement; you can. You either have to encase them inside of double-quotes or use the period (.) to append them together. Hope this helps.
Cheers!
Seth Warner
5,348 PointsSeth Warner
5,348 Pointswith a ; at the end of diff of course, sorry I didnt see that.