title: php convert string into conditional statements
body: <p>I have a bi dimensional array of array with homogeneous values.</p>
  
  <pre><code>$input = array(
       'x' =&gt; 100, 'y' =&gt; 101, 'type' =&gt; 'yes', value =&gt; 10
  ), array(
       'x' =&gt; 110, 'y' =&gt; 101, 'type' =&gt; 'no', value =&gt; 10
  ), array(
       'x' =&gt; 120, 'y' =&gt; 102, 'type' =&gt; 'yes', value =&gt; 99
  );
  </code></pre>
  
  <p>I need to find out a way to write a function to filter values passing a "text" filter as input:</p>
  
  <pre><code>//extract all values when $tye = yes and $value is greater than 10
  custom_filter($input, "type = yes and value &gt; 10");
  
  //extract all values when $x is equal to $y
  custom_filter($input, "x = y");
  
  //filter all values for x is pair and y is odd
  custom_filter($input, "x % 2 = 0 and y % 2 &gt; 0");  
  </code></pre>
  
  <hr>
  
  <pre><code>function custom_filter($input_array, $condition) {
       (...)
  }
  </code></pre>
  
  <p>Is there a way to "translate" $condition parameter from human readable statement to a php conditional statement?</p>