title: What is the prefered way to converting a string to an int, security-wise?
body: <p>There are multiple ways of converting a string to an integer.</p>
  
  <pre><code>$someString = substr($input, strripos($input, "_") + 1);
  $i = $someString + 0;
  $i = (int) $someString;
  $i = intval($someString);
  </code></pre>
  
  <p><code>$someString</code> comes from use input, so that might have to be taken into consideration. Which option is &ldquo;better&rdquo; or has the most negative side-effects? (i.e. performance-wise, security-wise)</p>
  
  <p><code>$input</code> can look something like <code>1_abcd_1</code> or <code>1_abcd_2</code>. That is quite fixed &mdash; except for the <em>abcd</em> which is made up in this example. This input comes from radio buttons, but a user can always alter their data if they want to. Thus, I have to account for malicious data.</p>