PDO
PDO, or PHP Data Objects, is a consistent, object-oriented data access layer in PHP. It provides a lightweight, database-agnostic interface for performing common database operations through a uniform API, while delegating database-specific details to individual drivers. The goal is to allow applications to switch database systems with minimal code changes.
PDO relies on drivers that implement the extension for each database (for example, PDO_MYSQL, PDO_PGSQL, PDO_SQLITE).
Key features include prepared statements, which help prevent SQL injection; transactions with commit and rollback; a
Error handling is typically configured to throw exceptions (PDO::ERRMODE_EXCEPTION) to enable try-catch blocks. PDO does not
Use of PDO is common in PHP applications that require database portability or a clean separation between