create truth table in php (AND / OR)
<p>i have an array contain value like </p>

<pre><code>Array
(
    [0] = true
    [1] = OR
    [2] = true
    [3] = AND
    [4] = false
    [5] = AND
    [6] = true
)
</code></pre>

<p>i want to create truth table in php like e.g </p>

<pre><code>true OR true = result1
result1 AND false = result2
result2 AND true = result3
</code></pre>

<p>i'm stupid and not b able to create yet. :(</p>

<p>here is my code</p>

<pre><code>foreach( $arrValue as $val  )
{
     if(!empty($val))
     {
    if($val=='true')
        $p = true;
    elseif($val=='false')
        $p = false;

    if(isset($p))
    {
            if(isset($result))
        {
             if($val=='AND')
             $result = $result AND $p;                      
        elseif($val=='OR')
             $$result = $result or $p;              

        }
       else
        $result = $p;
    }           
    }
}
</code></pre>

<p>please help this stupid boy to get results.</p>
