is PDO::PARAM_INT redundant?
Does PDO::PARAM_INT
perform an开发者_如何学Cy function at all when used with $db->quote()
function? e.g. $db->quote($user['id'], PDO::PARAM_INT)
?
It seems like it is, because even string input will get passed trough. Not to mention that it keeps the quotes around the integer. Is there any reason why should I use it?
It has no effect, since, after all, you are running the quote
function. It's only natural that it gets wrapped in quotes. PDO::PARAM_INT
is likely more important in other contexts, like prepared statements, where it is actually handled differently than strings.
quote
likely is more concerned with other data types that should not be quoted or should be quoted differently, like PDO::PARAM_BOOL
精彩评论