<?php $x=rand(1,3); switch ($x) { case 1: echo "One"; break; case 2: | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

<?php $x=rand(1,3); switch ($x) { case 1: echo "One"; break; case 2:

https://code.sololearn.com/wX9bkKfvAFs1/?ref=app

9th Aug 2019, 2:52 AM
Rajat Khatore
Rajat Khatore - avatar
4 Answers
+ 6
Rajat Khatore random number generator is used in your code snippet so when you run it multiple times you will see other two option too came as the output.
9th Aug 2019, 3:24 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 7
Rajat Khatore what is your question as your linked code is working correctly do you have any query?
9th Aug 2019, 3:11 AM
GAWEN STEASY
GAWEN STEASY - avatar
+ 6
Rajat Khatore But in my case it prints No match.
9th Aug 2019, 3:16 AM
‎Virat
‎Virat - avatar
0
My query is that it is a random variable right so why it always print one not no match
9th Aug 2019, 3:13 AM
Rajat Khatore
Rajat Khatore - avatar