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 Arrays and Control Structures PHP Conditionals School's Out

yahya alhalki
yahya alhalki
1,149 Points

my question is why should we put || and not && between the current grade

my question is why should we put || and not && between the current grade i thought that if its || it means its okay if either of the conditions is true execute

that means if the current grade is 0 it will echo cause 0 is smaller than 12

elseif($currentGrade >= 9 || $currentGrade <= 12){ echo 'this is only for highschool student'; }

3 Answers

Because both conditions donโ€™t need to be true just one or the other.

yahya alhalki
yahya alhalki
1,149 Points

yeah but wouldn't that mean if we just entered 0 it would be true cause 0 is smaller than 12.

yahya alhalki
yahya alhalki
1,149 Points

oh oKKK i totally got it what she was trying to do

thank you for your time jeff