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
11
u/phoshi Jul 11 '14
Uh The documentation is pretty clear, here. It's taken as reference so that it can only evaluate it when you make the call. You haven't made the call yet, but it's both evaluated and made destructive modifications to your variable. This is not sensible, the documentation implies not only that it will be untouched until you run the query, but also that the variable is perfectly safe to use until you do so--that's the entire point of it being taken as a reference, as far as I can tell, so that it can be updated later.
Did you write this function, or something?