I\'ve been looking for an answer to this but haven\'t found it anywhere. Are calls to PDO::prepare() cached, or should I cache the result myself, i.e. if I do the following
Two subsequent calls to PDO::prepare() (even with the same SQL query) should return two different PDOStatement (or handles) to avoid collisions, especially between previous and current bindings you may apply to it. The cost of creating a PDOStatement with prepare() is low anyway. What you may want cached are the results returned from the same SQL query, either raw or built by prepare() and this is a feature of your DBMS (MySQL for instance), not PHP.