开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜