title: PDO bindParam vs. execute
body: <p>I often see code using <code>bindParam</code> or <code>bindValue</code> with PDO.  Is simply passing arguments to <code>execute</code> frowned upon for any reason?</p>
  
  <p>I understand that <code>bindParam</code> actually binds to the variables and that you can set the type of parameter being bound with both <code>bind</code> methods, but what if you are only inserting strings?</p>
  
  <pre><code>$query = "SELECT col1 FROM t1 WHERE col2 = :col2 AND col3 = :col3 AND col4 = :col4";
  $pdo-&gt;bindValue(':col2', 'col2');
  $pdo-&gt;bindValue(':col3', 'col3');
  $pdo-&gt;bindValue(':col4', 'col4');
  </code></pre>
  
  <p>I often see the above, but personally I prefer:</p>
  
  <pre><code>$pdo-&gt;execute(array(':col2' =&gt; 'col2', ':col3' =&gt; 'col3', ':col4' =&gt; 'col4'));
  </code></pre>
  
  <p>It is not as verbose and visually it makes more sense to me to have the inputs "going in" to the query together.  However, I hardly ever see it used.</p>
  
  <p>Is there a reason to prefer the <code>bind</code> methods over passing parameters to <code>execute</code> when you don't have to take advantage of the special behaviors of the former?</p>