Specify More "case" in switch parameters
- by Sophie Mackeral
I have the following code:
$ErrorType = null;
switch ($ErrNo){
case 256,1:
$ErrorType = "Error";
break;
case 512,2:
$ErrorType = "Warning";
break;
case 1024,8:
$ErrorType = "Notice";
break;
case 2048:
$ErrorType = "Strict Warning";
break;
case 8192:
$ErrorType = "Depreciated";
break;
}
But the problem is, I'm going from the pre-defined constants for an error handling software solution.. I cannot specify more than one "case" for the dedicated error categories, example:
switch ($ErrNo){
case 1:
$ErrorType = "Error";
break;
case 256:
$ErrorType = "Error";
}
That's a repeat of code.. Whereas with a solution like my first example, it would be beneficial as two integers fall under the same category.. Instead, i'm returned with the following:
Parse error: syntax error, unexpected ',' in Action_Error.php on line
37