(no title)
candl
|
2 years ago
For scripts I use Python, but I like to use PHP for short quick scripts when a database is involved since all it takes is to install php and php-pdo to have a consistent api for db access to get started with, which for python is not the case.
But from time to time I am reminded how bad PHP and outright dangerous can be. Just the other day I had an array like this: ["123"=>"foo", "321" => "bar"] on which I used array_keys expecting to get ["123", "321"] as a result. Surprised why my script was not working the way it was supposed to I found out that the result was actually [123, 321] instead. Yep, PHP casts strings to numbers in this case when it can. I will hit a "gem" like this every now and then, there are plenty of such dumb things scattered in PHP that will bite you the least expected way that makes me stop and think to use something else.
drcongo|2 years ago
What's the difference between that and `pip install psycopg2` (which actually seems easier to me)?
candl|2 years ago