How would I do an OR statement with a Switch case? (PHP)

logic, php, switch-statement

Solution

switch($argv[$i])
{
    case '-V':
    case '--version':
        $displayVersion = true;
    break;
}

Problem

How would I go about converting this if statement: ``` for($i = 1; $i < $argc; $i++) { ... if(in_array($argv[$i], array('-V', '--version'))) { $displayVersion = TRUE; } ... } ``` Into a switch case without needing to write two switch statements?

Original source