title: PHP| PEAR:MDB2 vs PDO vs Native-PHP (Raw)
body: <p>After doing a sort of a research through out the Internet(And here at Stackoverflow) - I'm still struggling to decide which method is best for me to learn/use and dig more when programming in PHP.</p>
  
  <p>I understand some of the advantaged of using <strong>DAO when dealing with DB over using straight mysql_*</strong> functions spread out across the application files.</p>
  
  <p>When it comes to decide between <strong>MDB2 vs PDO</strong> - one thing that shine in favor of PDO is the fact that it doesn't abstract the mysql_* functions it talks directly to the mysql api just as the mysql_* do. It is also a compiled C extension to PHP so is very fast. While MDB2(or other libraries) are written in PHP so they need to be parsed at runtime and sit on top of the mysql_* functions. So, In terms of speed PDO wins?!?</p>
  
  <p>When it comes to compare <strong>DB abstraction layer over native-non-abstracted-PHP</strong> way shines the 
  security advantages of DB abstraction layers in the way of using binder params(prepared statements) that will prevent most sql injection attacks, plus it is easier to switch RDBMS type in the future if there is a need/request for that - even though it is not that common - (there are other advantages and nice consuming time feature in those DAO libraries).</p>
  
  <p>Anyway I hope that there are experts who can assist me to decide rather I should use one of those libraries and if so, which one is the most recommended?, or should I write my own DAO library that will serve me through all my projects and will get improved with years?.</p>
  
  <p>Thanks. </p>