why this Program dont work ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why this Program dont work ?

why this Program dont work ? there is no Output <?php $tarek=27; if ($tarek<=20){ echo "grand"; } elseif ($tarek>20 && $tarek<25) {echo "il faut saccelerer "; } else { "parfait"; } ?>

20th Jan 2018, 8:26 PM
Tarek Oudir
Tarek Oudir - avatar
8 Answers
+ 1
You are not echoing 'parfait'.
20th Jan 2018, 8:29 PM
Tarantino
Tarantino - avatar
+ 1
haha ah ok thinks, my god i did not sow the echo
20th Jan 2018, 8:34 PM
Tarek Oudir
Tarek Oudir - avatar
+ 1
ALSO: $tarek is 27 which is out of range as well: equal or less than 20 greater than 20 and less than 25
20th Jan 2018, 11:24 PM
non
+ 1
No I need to make >20 to see if the value are in the interval {20,25} , at the first else are not <= 20 so in elseif >20 than is < 25 or not
21st Jan 2018, 10:50 PM
Tarek Oudir
Tarek Oudir - avatar
+ 1
The value is
21st Jan 2018, 10:51 PM
Tarek Oudir
Tarek Oudir - avatar
0
No the program can run , I forgot only the echo at the last element.
21st Jan 2018, 12:10 AM
Tarek Oudir
Tarek Oudir - avatar
0
Yes, just pointing out the range, 27, being outside. I see it works. But you don't need the >20 bit on the elseif, it falls through from first if :)
21st Jan 2018, 10:44 PM
non
0
Will an example help? https://code.sololearn.com/c1vtphKl8Rfj/?ref=app (it's C++ but PHP structure works the same AFAIK)
23rd Jan 2018, 10:56 PM
non