Separating simple rules from PHP code
<p>At the moment I have some PHP which sets a single variable based on the value of other independent variables in a linear format, like so:</p>

<pre><code>$result = 0;

if ($var1 == 'X') {
  $result += 10;
}

if ($var2 &lt; 10) {
  $result += 15;
}
elseif ($var2 &gt; 50) {
  $result -= 50;
}

// more of the same
</code></pre>

<p>However, I'd like to be able to express these rules in a less programming-like way, mainly so that someone who doesn't know how to program can add/edit rules, and also because I might want to use the same rules in a Python or Perl script, without having to maintain copies in multiple languages. I could write my own simple language (for want of a better word) and parser, but I'd prefer to use an existing solution as that saves work and increases the likelihood that other people will know how to write rules in it.</p>

<p>Is there a sensible/obvious choice for this sort of task?</p>
