Good one. What about PHP?

PHP really is one of the least productive languages out there, as creating even simple things in PHP requires a significant cognitive load and constant googling for “which order did the arguments go in for this function”, “what’s the best pattern to solve this common issue with”, etc.

Python is predictable and often comes with the one correct way to solve your problems, where as the PHP community constantly has issues moving forward from their past mistakes. A classic example (tho less relevant nowadays) is how many *YEARS* their documentation recommended using code for database access with clear SQL injection issues (and very poor solutions to them, “mysql_real_escape_string”), another is the various array and string methods in PHP .. just try to memorize the argument order and if the function name uses _ to separate words in these cases:

in_array($needle, $haystack)
strpos($haystack, $needle)
array_key_exists($key, $array)
array_push($array, $value)

In addition to this PHP’s type juggling and habit of just chugging ahead in error cases is awful for trying to write durable code. Your system behaves exactly as if no errors ever happened just does an unexpected thing because PHP is trying it’s best to keep going regardless of errors, converts strings to ints, arrays, or whatever else seems convenient at the time and vice versa, even though there are clear errors in the code or input arguments.

Compare this to Python:
 * You generally have methods on objects, so there’s less need to memorize parameters in general, e.g. “string”.index(“i”) and [“i”].index(“i”)
 * Generally Python tries to make one solution that works for multiple cases, e.g. the “index” method above, or the “in” keyword: “i” in “string”, “i” in [“i”]
 * Python raises exceptions (which you can catch and do whatever you want with) whenever there’s an error with arguments or logic, a string is not an int, an int is not a string, “abc” + 123 is going to give you an exception, BUT on top of that there are LOTS of convenient ways to deal with these common cases, such as “abc{}”.format(123)

On top of this the power of Python as a language overall is just better, as it’s been debated carefully over decades, and been built purposefully. Just the fact that it’s a running application instead of a script and thus able to do a whole different class of optimizations and tricks (like Websockets) with much less effort makes a huge difference.

These days for anyone to seriously claim PHP is a good language to work in they must intentionally bury their head deep in sand and hum “LA LA LA” real loud.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.