5 ms·
PHP was my main language from 2000 to 2011. I liked PHP 4 very much. "Pass by value" was the default, so it accidentally introduced me to the Functional paradig
by lkrubner 4y ago
PHP was my main language from 2000 to 2011. I liked PHP 4 very much. "Pass by value" was the default, so it accidentally introduced me to the Functional paradigm, even though it didn't have the memory management to allow for real functional programming. (It did not internally share memory between old and new versions of an object.)
I dislike the direction that PHP has taken since the introduction of PHP 5. For the last 18 years or so, the language has been trying to become something like Java, but without the speed benefits we might get from it being compiled, and without the strictness benefits we might get from being strictly typed. Nowadays it has most of the heavy rituals of Java, but without any of the benefits.
The single greatest thing about PHP, circa 2000, was the abstraction it calls an "array" which combines what other languages would call a vector (or a list) and a hashmap (or dict in Python). That array construct was very flexible and allowed me to get away with a great deal. Later on I discovered the "seq" abstraction in Clojure, which is even more incredible, and has the added benefit of being done correctly, in an academic sense.
After 2011, I increasingly relied on Clojure, for any task where dynamic programming was reasonable. Clojure puts me on the JVM and allows me to drop into something like Java, and strict typing, in the rare cases where that seems necessary.
PHP in 2000 was extremely lightweight but nowadays it demonstrates of envy of heavier object oriented languages, but again, it still lacks the speed benefits of being compiled or the correctness checks offered by strict typing.
The article lists these benefits of PHP:
* speed
* ease of deployment
I don't think anyone would pick PHP purely on the basis of speed, again, there are many languages that are faster.
In terms of easy of deployment, any deployment of PHP (or Python, or Ruby) tends to mean deploying tens of thousands of files. By contrast, when I work in Clojure, I typically uberjar the code, and then I only have to deploy one file, which makes deployment ridiculously easy.
- datalopers 4y ago> I don't think anyone would pick PHP purely on the basis of speed, again, there are many languages that are faster. When it comes to interpreted languages (perl, python, ruby, js), PHP is hands down the fastest.
- piperswe 4y agoYou mention JS - I would be interested in seeing any benchmarks where the PHP interpreter beats V8.
- datalopers 4y agoThese are web frameworks specifically but a good broad suite of examples: https://www.techempower.com/benchmarks/#section=data-r21&l=zij5z3-6bj https://www.techempower.com/benchmarks/#section=data-r21&l=z... An amazingly fast specialized JS runtime solution [1][2] does indeed have the #1 spot on the most recent rounds, but full PHP frameworks hold spots #2 - 29 and then it's a mixture of PHP and JS all the way to #58 before we see the first other language (python, uvicorn) emerge. [1] https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/JavaScript/just https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast... [2] https://github.com/just-js https://github.com/just-js
- larve 4y agoYou can also do some pretty "fun" things with PHP leveraging the opcache. I wrote what in my own personal biased benchmark was the fastest mustache template renderer by transpiling mustache to php files and then "compiling" them with apc [1]. Kind of a poor man's staging / partial evaluation optimizer. This is still running https://goldeneaglecoin.com/ https://goldeneaglecoin.com/ whose framework (and HTML/CSS) is pretty much untouched since 2011. It is running on an ec2 t2.medium instance and is one of the fastest e-commerce sites i know. [1] https://github.com/wesen/proust https://github.com/wesen/proust
- proton_9 4y agowow, that was some incredible performance, never thought php could be this fast, I was in a dilemma on what language to focus on as an ordinary dev, think I'll stick with php for a while longer.
- jetbalsa 4y agoI abuse the crap out of PHP "arrays" between mapping to JSON rather well and allowing you to really put some strange data, functions and objects into them you can really get some work done with data processing.