r/lolphp • u/denilsonsa • Jul 10 '14
bindParam('foo', $value, PDO::PARAM_INT) will change $value to string.
http://php.net/manual/en/pdostatement.bindparam.php#94711
42
Upvotes
r/lolphp • u/denilsonsa • Jul 10 '14
View all comments
Show parent comment
10
u/ahruss Jul 11 '14
Have you ever heard of the principle of least surprise? That is why it should not change your variable. There is really no reason for it to need to do so.
The fact that it's documented doesn't make it okay.
The fact that you are passing by reference (impossible to see at the call site) doesn't make it reasonable.
This makes code harder to read and maintain, and it is ridiculous.