Overview

MX Calculator provides mathematical operations in ExpressionEngine 2 templates. MX Calc is build with modified class EvalMath (thanks to Miles Kaufmann) for safely evaluate math expressions.

Requirements

  1. ExpressionEngine 2

Example

you can used it as single tag
<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">{exp</span><span style="color: #007700">:</span><span style="color: #0000BB">mx_calc&nbsp;expression</span><span style="color: #007700">=</span><span style="color: #DD0000">"-4(15/42)^23*(4-sqrt(16))-15"</span><span style="color: #0000BB">}&nbsp;</span>
</span>
</code></div>
or as tag pair
<div class="codeblock"><code><span style="color: #000000">
<span style="color: #0000BB">{exp</span><span style="color: #007700">:</span><span style="color: #0000BB">mx_calc&nbsp;expression</span><span style="color: #007700">=</span><span style="color: #DD0000">"-4(15/42)^23*(4-sqrt(16))-15"</span><span style="color: #0000BB">}<br />Cost&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">{calc_result}<br />{</span><span style="color: #007700">/</span><span style="color: #0000BB">exp</span><span style="color: #007700">:</span><span style="color: #0000BB">mx_calc}&nbsp;</span>
</span>
</code></div>
is this code works? [ Test it NOW! ]