In PHP coding I have to create a form and use a switch statement for the question below?

Mayur

New member
Type in three numbers then output numbers increasing in size.

It has to be a switch statement, it cannot be an if statement. I have spent three hours on it and I still can't figure it out.If you can solve this problem using a switch statement it would really help me and I will be very greatful. The coding is in the previous question. Thank you very much
 
Ok. Seems like an odd way to do it (using switch instead of if), but apparently you can (see my source below) so it would look something like this (you can fix the exact syntax)

switch (true) {

case ((a <= b) && (b < = c))
print a b c
break;
case ((b <= a) && (a <= c))
print b a c
break;
case ((c <= b) && (b <= a))
print c b a
break;
case ((b <=c) && (c <= a))
print b c a
break;
case ((a <= c) && (c <= b))
print a c b
break;
case ((c<=b) && (b <= a))
print c b a
break;

}
 
Ok. Seems like an odd way to do it (using switch instead of if), but apparently you can (see my source below) so it would look something like this (you can fix the exact syntax)

switch (true) {

case ((a <= b) && (b < = c))
print a b c
break;
case ((b <= a) && (a <= c))
print b a c
break;
case ((c <= b) && (b <= a))
print c b a
break;
case ((b <=c) && (c <= a))
print b c a
break;
case ((a <= c) && (c <= b))
print a c b
break;
case ((c<=b) && (b <= a))
print c b a
break;

}
 
Back
Top