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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Bence Szatmári](https://secure.gravatar.com/avatar/e2290b9b258df1be3db75adcfadab8a0?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Bence Szatmári
9,235 PointsI don't understand this.
Hi! I want to ask why do we write this if statement here:
<?php
if(strtolower($item['category']) == 'books'){
?> <-----
<?php } ?> <---
Why are we put php open and closing tags where i put the arrows? I hope you can understand what is my problem .
2 Answers
![Ashton Norton](https://secure.gravatar.com/avatar/c961e54f97f7e5f4af04e9091aa8d0c3?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ashton Norton
7,704 PointsThe reason being is so you can insert HTML. This means that any HTML you put in there, will only appear if your statement is true.
![Ashton Norton](https://secure.gravatar.com/avatar/c961e54f97f7e5f4af04e9091aa8d0c3?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Ashton Norton
7,704 PointsThis works for any other code block too. You can use it in functions and loops. It's pretty useful to use straight html and not have a bunch of echoes. Also makes it more readable.
Bence Szatmári
9,235 PointsBence Szatmári
9,235 PointsSo we are using this because we are not using 'echo "<tr>"' just simple html tags and it will only appear if our statment is true?
Bence Szatmári
9,235 PointsBence Szatmári
9,235 PointsI think I can understand now ! Thank You!