1007
PHP is dead?
(telegra.ph)
Post funny things about programming here! (Or just rant about your favourite programming language.)
I used to think that php was a bad language until recently (used php5 when i was just learning to program, cooked some delicious spaghetti). But after 5 years I had to use PHP at work. The language has improved a lot, but I think a lot of the bad parts are still there.
Like, why does stdclass exist? Why not just use associative arrays? Why are there warning, error, fatal errors, exceptions? Some functions throw exceptions, other raise errors, others return false, other fail silently and you have to call another function to check if there was an error (
last_json_error
). Why do find functions returnfalse
instead of-1
? Like every other language? Why can't I use strings with numeric values as maps keys? (I can't have["001" => value]
, it gets casted to["1" => value]
.There are no generics, you have to use
mixed
everywhere. The stdlib is an inconsistent mess, some_snake_case, someCamelCase, verb_noun, noun_verb, functions are not namespaced, everything is global. A lot of duplicates: die vs exit, print vs echo, etc. You are forced to use PSR & autoload to be able to use namespaces in a tolerable way, not including_once everywhere. No UTF-8 support, only ascii. You have to manually use mb_ functions. Variable scoping is weird. Variable variables? Why?And all that is just comparing it to the average language. If compared to a modern language like Rust, Zig, Swift, php is light years behind.
It's not hot garbage, but I wouldn't call it "good". There's laravel, but not much more. PHP still makes you shoot yourself in the foot by default, unless you spend a lot of time learning its edge cases. Just like javascript.