title: PHP intval() behaviour?
body: <p>This sounds to strange to me:</p>
  
  <pre><code>$test_1 = 'string';
  $test_2 = '0';
  
  var_dump(intval($test_1)); // Output: int 0
  var_dump(intval($test_2)); // Output: int 0
  
  $can_cast = intval($test_2) ? 'sure' : 'nope'; // Wrong!!!
  </code></pre>
  
  <p>So with a <code>string</code> to <code>int</code> conversion <code>intval</code> returns <strong>0</strong>. Fine, but it returns <strong>0</strong> also when the string actually can be casted to zero (because <em>is</em> zero) thus valid.</p>
  
  <p>How can one can distinguish between both (allows '0' as string and deny 'string')?</p>
  
  <p><strong>EDIT</strong>: ok let me say i know i can use <code>is_numeric</code>. <code>But is_numeric('2.3')</code> returns <code>true</code>, so it can't help. And:</p>
  
  <pre><code>$test = '0';
  var_dump(is_numeric($test) &amp;&amp; intval($test)); // Fail!!!
  </code></pre>