$name = "John O'Neil"; $pdo = new PDO($dsn, $user, $password); $escaped_name = $pdo->quote($name); echo $escaped_name;
'John O\'Neil'
$age = 25; $pdo = new PDO($dsn, $user, $password); $escaped_age = $pdo->quote($age); echo $escaped_age;
'25'Even though integers don't need to be escaped in SQL statements, PDO quote still works by converting the integer to a string and quoting it. Package/library: PDO is a PHP extension/library for interacting with databases, and PDO quote is one of its built-in functions.