I have the following array:
$groupA= array(1,10);
$groupB = array(11,20);
$groupC = array(21,30);
The user has the ability to enter any numerical value in the text field, for example, "5", now I need to display the user in whose group this number is. I have done this before:
And then do this:
switch ($input){
case ($input>= $groupA[0] && $input<= $groupA[1]):
echo "You are in Group A.";
break;
case ($input>= $groupB[0] && $input<= $groupB[1]):
echo "You are in Group B.";
break;
However, this seems impossible, since we have many groups (probably more than 200), and using this large number of wiring closets is inefficient.
Any ideas on how to solve this problem more elegantly?
source
share