Is there a performance difference if an integer is bound as a string in a prepared PDO request? In Mysql, queries work either if the value is bound as an int or a string, but is there a difference in performance or any errors in doing so?
$pdo = new PDO(
"mysql:host={$host};port={$port};dbname={$dbname};charset=utf8",
$username,
$password
);
$statement = $pdo->prepare("SELECT * FROM `table` WHERE `id` = :param");
$statement->bindValue(":param", 5);
$statement->bindValue(":param", 5, PDO::PARAM_INT);
$statement->execute();
Is there a difference between binding a parameter and specifying its type or just quoting it as a string?
source
share