Is there a way to return the total number of (case) instances there are in a switch statement? Something like this:
$id = $_GET['id'];
switch ($id) {
case "item1" :
$data = 'something1';
break;
case "item2" :
$data = 'something2';
break;
}
echo $data;
But the reasoning for it is there are multiple files with these switch statements in them, but the number of them vary depending on the file. I'd ideally like to be able to loop through these switch statements by incrementing the "id". Any ideas on if this is possible?