title: Convert a comma-delimited string into array of integers?
body: <p>The following code:</p>
  <pre><code>$string = &quot;1,2,3&quot;
  $ids = explode(',', $string);
  var_dump($ids);
  </code></pre>
  <p>Returns the array:</p>
  <pre><code>array(3) {
    [0]=&gt;
    string(1) &quot;1&quot;
    [1]=&gt;
    string(1) &quot;2&quot;
    [2]=&gt;
    string(1) &quot;3&quot;
  }
  </code></pre>
  <p>I need for the values to be of type <code>int</code> instead of type <code>string</code>. Is there a better way of doing this than looping through the array with <code>foreach</code> and converting each <code>string</code> to <code>int</code>?</p>