Switch Case Vs. If.. Else (specific task)
<p>I have 3 arrays that could be set or not. Their keys are strings.</p>

<p>Would it be more efficient this If... Else</p>

<pre><code>if( isset( $arrayA[ $id ] ) )
{
    if( isset( $arrayB[ $id ] ) )
    {
        if( isset( $arrayC[ $id ] ) )
        {
        }
        else
        {
        }
    }
    else
    {
        if( isset( $arrayC[ $id ] ) )
        {
        }
        else
        {
        }
    }
}
else
{
    if( isset( $arrayB[ $id ] ) )
    {
        if( isset( $arrayC[ $id ] ) )
        {
        }
        else
        {
        }
    }
    else
    {
        if( isset( $arrayC[ $id ] ) )
        {
        }
    }
}
</code></pre>

<p>or a Switch... Case like this?</p>

<pre><code>$ABC = ( isset( $arrayA[ $id ] ) ? "1" : "0" ) . ( isset( $arrayB[ $id ] ) ? "1" : "0" ) . ( isset( $arrayC[ $id ] ) ? "1" : "0" );

switch( $ABC )
{
    case "001":
    case "010":
    case "011":
    case "100":
    case "101":
    case "110":
    case "111":
}
</code></pre>

<p>Note that "000" case will never occur in my script.</p>

<p>Suppose I know combinations' frequency.
More frequent ->
"110"
"111"
"010"
"100", "101", "001"
"011"
&lt;- Less frequent</p>

<p>Anyway "110" and "111" occur almost always. "010" could occur 1 time per 10^4 or 10^5 times the cumulative occurrence "110"+"111".</p>

<p>Would this If... else a better solution?</p>

<pre><code>if( isset( $arrayA[ $id ] ) and isset( $arrayB[ $id ] ) )
{
        if( isset( $arrayC[ $id ] ) )
        {
        }
        else
        {
        }
}
else
{
    $ABC = ( isset( $arrayA[ $id ] ) ? "1" : "0" ) . ( isset( $arrayB[ $id ] ) ? "1" : "0" ) . ( isset( $arrayC[ $id ] ) ? "1" : "0" );

    switch( $ABC )
    {
        case "001":
        case "010":
        case "011":
        case "100":
        case "101":
    }
}
</code></pre>