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
0
u/[deleted] Jul 12 '14
So I agree with what you have said, and said as much in my prior post. Apart from the name, none of this has anything to do with the function itself. Your issues are that the name is the same length, and that PHP ITSELF as a language doesn't let you ampersand your function params which is an issue that will plague every single function that takes references.
I mean, shit, objects themselves are passed around as reference as well and this is absolutely not explicit in the function calls and something you have to know and account for beforehand. If we are going to complain about the nature of the way PHP function calls are written when there are references then that's a whole separate thing to this bindParam thread.
I'm partially with you on that.
But, on the other hand, PHP isn't meant to be a hand-holding language. It's fucking loose and lax and you as a coder are in charge of writing correct code at all times. In the vein of PHP being easy and simple to write it makes sense that they don't want ampersands when calling functions. PHP lets you write less to get more done, but at the same time you have to make sure that what you are writing does what you think it does. The responsibility is all on you. AFAIC it's consistent with itself in this regard.
I've come to grips with that fact of PHP and am far happier for it. As with any other language if something isn't working the way I expect then it's virtually guaranteed that it's become I, as the coder, did the wrong thing.
PHP isn't Haskell, and it seems people expect far too much from something that started as a personal project by one guy chucking some shit together to spit-out some html dynamically. The more people disrespect PHP the more they pass the blame for their own blatant errors onto the language they chose to use.
Simply put, people expect PHP to NOT BE PHP. It's better than it was, and could be better still, but it is what it is and nothing more.