4 ms·
modern PHP has become indistinguishable from Java, which begs a question: why PHP, when Python is less verbose, if you want less verbosity and scripting. and J
by slt2021 3y ago
modern PHP has become indistinguishable from Java, which begs a question: why PHP, when Python is less verbose, if you want less verbosity and scripting.
and Java is same verbosity + has more mature (and arguably more performant) runtime + benefits of statically compiled language and rich library ecosystem?
what is selling point of PHP, that python and java don't fit into ?? (lets not even mention javascript/node with its runtime)
- endofreach 3y agoI can think of many reasons, but for starters (obviously focused on web dev): - pythons dependency management is insane. For PHP Composer seems a bit aged, but compared to all others i've had to work with in the last decade, it's still the best to work with - the PSRs are pretty good & make the whole language seem like a good big framework - php can actually be very fast nowadays - decent type system (if you're unlike me any don't hate working with annotations, you'll be even happier) - since php8 (especially 8.1 and 8.2) there were a lot of major new things (property promotion, named parameters) On the contrary: - php.ini must die. It's not causing much issues for me anymore, but it just doesn't feel right. I don't know why, but no matter how much i work in other languages, even if i really enjoy them (eg. go), nothing when starting from scratch for web server stuff, i always end up going with PHP. Whenever it's "just web" on the serverside, nothing beats php. Especially when you ignore the bad stuff and look at really well designed modern projects based on php8. I just think it might be time to fork php8, start with a new name & get rid of all the old, dirty stuff that's still there for some weird & non-realistic backward compatibility. If anyone is up for that task, i am happy to help & finance parts of that.
- aaviator42 3y agoI agree with a lot of your comment, but what's wrong according to you with php.ini? I've always found it a really handy way to customise the behaviour of my php installs and apps, and I've actually learnt a fair bit from just reading through the comments and following the links it contains.
- endofreach 3y agoActually, i can't say what i would propose as a better way without having to spend some time thinking. While i was expanding on my php.ini mini-rant, i realized that i wouldn't be able to answer a question like yours. I just seem to be hater for no valid reason other than very personal things like: - hating the ini syntax - issues with module conflicts - how the overloading works Might be my experience of annoyances when i didn't know the issues might be related to php.ini settings. And (still today), i only find out after googling issues like a moron. I just have the feeling another solution might offer much better dev experience. But yeah, i can't offer any helpful insight here. Maybe it's just that i don't want to have to initialize at all, given that the PHP we talk about is not the one running on funny hardware, but rather purposefully configured servers anyway. But yeah, not sure what a better alternative would be right now without digging in to it.
- tmh88j 3y agoYou seem to be emphasizing syntax rather than features of the languages and the stack itself. PHP was designed from the ground up for the backend side of web. Python, JS and Java were not. Many fundamental web development features are built into PHP like sessions, cookies, HTTP request variables, while a language interface server like Gunicorn or runtime like node is required to generate much of that from the incoming request and forward it to your application. Once it gets to your application either you or a library then needs to track those cookies, sessions, etc.. That's all built into PHP. So instead of a call sequence for a python/node app being request -> nginx -> Gunicorn -> python app, with PHP it's just request -> nginx/apache -> php app. There are plenty of other web-specific features that are dead simple in PHP like header redirects and HTML templating, whereas with python/node/java they have to be implemented by you, your framework or a language interface server.
- slt2021 3y agoI like index.php type websites, that are not verbose. but PHP code that consists of 30+ composers modules, each with 10+ classes with overengineered OOP crap does not encourage me to touch this code with a 10ft pole. This has devolved into js type of crappy coding, and I can use JS for that, dont need PHP.
- tmh88j 3y agoI'm not exactly sure what you're suggesting, but blaming sloppy codebases you've seen is an unfair, cheap shot at the language instead of calling out bad developers, which applies to every language. PHP is inherently less complex than languages like JS and python for the backend and results in fewer dependencies because it comes with more features specific to web development out of the box. Quite literally no features required to build even a very basic dynamic website come with JS out of the box: sessions, password hashing, database connectors, input sanitizing, cookies, html templating, etc... It all needs to be either written by you or installed as a dependency. They're all standard features in PHP.
- hipadev23 3y agoModern PHP isn’t necessarily verbose. It’s only when the authors choose to go that route.
- craigmcnamara 3y agoI've written plenty of PHP, mostly out of necessity, but I find the language to be hideous. It's like they took only the worst parts of other languages and piled it all in to one full of `$` and `->` for no good reason. I've been a Ruby programmer for the last 15 years, but I spent 6 years writing lots of MFC flavored C++ and Java and I honestly can't fathom why given the opportunity to improve the language starting around PHP 5 they made the choices they did. It's like they saw good things other languages had and just did lazy imitations with the worst possible syntax. Composer is a half assed copy of Bundler and I still can't believe that a global php.ini is a thing.