Removing 3 nested if-then-else
<p>I'm seeing this code as the equivalent of a mathematical permutation. It tries to set the value of <code>$d</code> based on a combination of <code>$a, $b, $c</code>. Right now it's being done with 3 nested if/then/else. Any other way the same thing can be done more efficiently?</p>

<pre><code>if ($a === true) {
    if ($b &gt; 0) {
        if ($c === true) {
            $d = 6;
        } else {
            $d = 2;
        }
        $e = $b;
    } else {
        if ($c === true) {
            $d = 4;
        } else {
            $d = 0;
        }
    }
} else {
    if ($b &gt; 0) {
        if ($c === true) {
            $d = 5;
        } else {
            $d = 1;
        }
        $e = $b;
    } else {
        if ($c === true) {
            $d = 7;
        } else {
            $d = 3;
        }
    }
}
</code></pre>

<p>Notice there's <code>$e = $b;</code> at the end of</p>

<pre><code>if ($a === true) {
    if ($b &gt; 0) {
} else {
    if ($b &gt; 0) {
</code></pre>

<p>I think I will just remove it out of the whole look and say</p>

<pre><code>if ($b &gt; 0) {
</code></pre>

<p>Any error with that logic for <code>$e = $b;</code>?</p>
