Using comparison operators stored in an array
<p>I have the following example array:</p>

<pre><code>$comparisons = array(
    0 =&gt; array(
        'method'    =&gt; 'productTotalQuantity',
        'operator'  =&gt; '&gt;=',
        'value'     =&gt; '2'
    ),
    1 =&gt; array(
        'method'    =&gt; 'productTotalWeight',
        'operator'  =&gt; '&lt;=',
        'value'     =&gt; '10'
    )
);
</code></pre>

<p>I have invented this array structure, so it can be altered if required.
I am trying to somehow evaluate the operator key, so that I can achieve something along the lines of:</p>

<pre><code>foreach ($comparisons as $comparison) {
    $value = $this-&gt;$comparison['method']($product);
    // E.g. $value = $this-&gt;productTotalQuantity($product)
    // $value could = 4

    if ($value $comparison['operator'] $comparison['value']) {
        // Comparison successful
        $matches[] = TRUE;
    }
}

if (count($matches) == count($comparisons)) {
    // All comparisons were successful. Apply the discount.
}
</code></pre>

<p>If you have time, a full code example of how to parse this array would be extremely helpful. I've been working on it for about 20 hours straight and think I'm about to literally bash my head against a brick wall. If you are familiar with Magento, I am trying to somewhat mimic the functionality of the "Shopping Cart Price Rule" Conditions in Promotions.</p>
