Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
This is horrible. But I do use ot sometimes for checking the type of exceptions. Each case is then almost the same so less horrible and mor readable than ifstatements.
-
taylan3517yThey should search for good devs who know PHP rather than good PHP devs. Because good PHP devs are not good for some reason.
-
People do this because PHP (and many other OOP languages) are missing a feature called "pattern matching" — so they abuse the switch statement to perform the task.
-
@taylan
I think Java/C# do OOP better, Rust and Haskell do types better, and most C programmers will do optimizations and algorithms better.
PHP is useful because you can quickly get to where you need to be in terms of web development.
But you need discipline to structure your code, to create the right kinds of classes, tests and type checks.
I wouldn't say that a dev who only knows PHP is always bad, but PHP is certainly not the best place to learn about those disciplines.
Related Rants
"We want a perfect PHP dev"
... yea, and he will produce shitcode like
switch(true) {
case 1 < 2:
...
case $a == $b:
...
}
no thx
undefined
php
diephp