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