title: Evaluate string as condition PHP
body: <p>I have a custom validation rule module that essentially allows users to set up CSV validation. My problem is I get it to this array:</p>
  
  <pre><code>Array(
      [field_name] =&gt; 'is_int(324230435)',
      [some_other_field] =&gt; 'strlen("some str") &gt; 25'
  )
  </code></pre>
  
  <p>I did some research and came across the <code>eval()</code> function.</p>
  
  <p>refs: <a href="https://stackoverflow.com/questions/37296199/how-to-use-string-in-if-condition-in-php">How to use string in IF condition in PHP</a></p>
  
  <p>However, I really don't want to use <code>eval()</code> due to the security issues (ref: <a href="https://stackoverflow.com/questions/951373/when-is-eval-evil-in-php">When is eval evil in php?</a>)</p>
  
  <p>Although it doesn't strictly say eval is evil, I still would prefer if there was an alternative method.</p>
  
  <p>Am I being over-cautious about the usage of <code>eval()</code> - perhaps I should escape and use <code>eval()</code> or is there a better way?</p>