title: How can I pass an array of PDO parameters yet still specify their types?
body: <pre><code>$sql = "SELECT * FROM table WHERE id LIKE CONCAT('%', :id, '%')
  LIMIT :limit1, :limit2";
  </code></pre>
  
  <p>I want to still use the array input like this:</p>
  
  <pre><code>$stmt-&gt;execute($array);
  </code></pre>
  
  <p>Otherwise I cannot reuse the same method for executing my queries.</p>
  
  <p>At the same time, the :limit1 and :limit2 doesn't work unless it is put in like this:</p>
  
  <pre><code>$stmt-&gt;bindParam(':limit1', $limit1, PDO::PARAM_INT);
  </code></pre>
  
  <p>I tried to do both but it doesn't execute with the bindParams:</p>
  
  <pre><code>$stmt-&gt;bindParam(':limit2', $limit2, PDO::PARAM_INT);
  $stmt-&gt;execute($array);
  </code></pre>
  
  <p>What is the way around it?</p>
  
  <p>I thought I could extend PDOStatement and add a new method "bindLimit" or something but I can't figure out what internal method PDO uses to bind parameters to a variable.</p>