title: Conversion from string to int does not work
body: <p>I use a regex to get a value from a document and store it in a variable called <code>$distance</code>. That is a string, but I have to put it in an int column of a table in a database.</p>
  
  <p>Of course, normally I would go and say</p>
  
  <pre><code>$distance=intval($distance);
  </code></pre>
  
  <p>But it doesn't work! I really don't know why.</p>
  
  <p>This is all I am doing:</p>
  
  <pre><code>preg_match_all($regex,$content,$match);
  $distance=$match[0][1];
  $distance=intval($distance);
  </code></pre>
  
  <p>The regex is correct, if I echo $distance, it is e.g. "0" - but I need it to be 0 instead of "0". Using intval() will somehow always convert it to an empty string.</p>
  
  <h2>EDIT 1</h2>
  
  <p>The regex is this:</p>
  
  <pre><code>$regex='#&lt;value&gt;(.+?)&lt;/value&gt;#'; // Please, I know I shouldn't use regex for parsing XML - but that is not the problem right now
  </code></pre>
  
  <p>Then I proceed with</p>
  
  <pre><code>preg_match_all($regex,$content,$match);
  $distance=$match[0][1];
  $distance=intval($distance);
  </code></pre>