Is there a way to return the total number of instances (case) in a switch statement? Something like that:
$id = $_GET['id'];
switch ($id) {
case "item1" :
$data = 'something1';
break;
case "item2" :
$data = 'something2';
break;
}
echo $data;
But the argument is that they have several files with these switch statements, but their number depends on the file. Ideally, I would like to be able to scroll through these switch statements, incrementing the "id". Any ideas on whether this is possible?
John
source
share