Live data from Hacker News

PHP 8: Before and After

stitcher.io

281–290 of 346 posts

Re: PHP 8: Before and After

#281
post #267

Earlier quoted context omitted.

If you mean persistent databases or caching like Redis, it's still much easier to accidentally reference a global pointer due to a programming error than accidentally put something in a cache store. All systems need some sort of persistence, this is true for other languages as well.

No, I'm talking about the kind of thing that provides a `Context`-like object that allows the application developer to share memory between requests.

you mean $_SESSION? that was there since at least php4

Re: PHP 8: Before and After

#282
post #273
post #230

One of the underappreciated pros of php for web development is its execution model, it's fault tolerant by default and shares little memory across requests. This kind of makes sloppy programming far more tolerable in php than in other platforms. In effect this has an impact on performance but it also helps in ensuring that a bad request can't blow out the whole application from serving other requests like is common i…

What I miss about PHP is that it was possible to put a file in a folder and use it instantly. If you want to quickly do something without diving into frameworks the tooling was easy to setup and rarely fell apart, if ever. There are not many moving parts, you usually have a web server that is very solid and comes with an installer that you hit next next next. Then you have a database server, usually MySQL. Sometimes…

This is still possible, how do you think isn't anymore? As example I mean

Re: PHP 8: Before and After

#283
post #273

Earlier quoted context omitted.

What I miss about PHP is that it was possible to put a file in a folder and use it instantly. If you want to quickly do something without diving into frameworks the tooling was easy to setup and rarely fell apart, if ever. There are not many moving parts, you usually have a web server that is very solid and comes with an installer that you hit next next next. Then you have a database server, usually MySQL. Sometimes…

This is still possible, how do you think isn't anymore? As example I mean

Not OP but I read this as something they miss because they no longer work with PHP.

Re: PHP 8: Before and After

#284

Can a fellow geek knowledgeable in PHP gives me a few pointers? I have inherited a 12 year old PHP app written by 2 interns. The code was written with Notepad++ (no IDE), no comments except when they copy pasted something from the internet, most variables are single letter and it's the biggest spaghetti bowl I have ever seen. To add insult to injury I have no experience with PHP (apart from peeking at this code to fi…

As others pointed, the best thing you can do is learn to debug PHP interactively with an IDE (easier locally) so you can step, REPL and so on, into a mess of a code to improve it

Re: PHP 8: Before and After

#285
post #283

Earlier quoted context omitted.

This is still possible, how do you think isn't anymore? As example I mean

Not OP but I read this as something they miss because they no longer work with PHP.

Exactly :) Last time I touch PHP I think it was 5, I don’t know what happened in between so when I say “was” I mean it was for me.

Re: PHP 8: Before and After

#286
post #97

Earlier quoted context omitted.

Roughly in the order you should do it. Hopefully it's at least PHP 5.3 code: 1. Definitely get a PHP IDE: https://www.jetbrains.com/phpstorm/ 2. Get a step debugger and hook it in: https://xdebug.org/ 3. Fix the code style: https://github.com/FriendsOfPHP/PHP-CS-Fixer 4. Run the code through some static analysis tools https://phpstan.org/ https://psalm.dev/ 5. Upgrade the code with an AST fixer (might help you update…

In addition: - Make sure you have version control. So easy to do these days, so often forgotten. - don't think that the steps above must be done in order, right now. - dkarlovi mentions tests. Start with 1.) smoke tests like simple selenium tests or something like that. You'll find lots of vate towards it if you look and I admit it has issues but for simple projects like this that doesn't change much it should be fin…

There's also "Modernizing Legacy Applications in PHP": https://leanpub.com/mlaphp (but leanpub seems to be down right now lol)

Re: PHP 8: Before and After

#287

Earlier quoted context omitted.

Yeah, It's because certain devs instead of adopting a defensive position in favor of PHP. They don't think in the fact that there are many alternatives of programming languages even superior than PHP for different use cases and exigencies. E.g Lua, Julia, Erlang, Python, even the slow Ruby just to name few of them.

"Lua, Julia, Erlang" For most CRUD web development, using Lua/Julia/Erlang has a heavy cost upfront of learning, finding developers and many other issues like hosting etc. PHP works out of the box on most servers and has a mature ecosytem. So this is why I cannot just get into Lua or Julia because it is much better than PHP. It is all about cost vs benefit analysis. Sure, if I am building something like whatsapp, I s…

Are you arguing that PHP is the quickest way to get started in the case where you already know PHP but not any other language, i.e. writing a program in PHP compared to learning another language from scratch and then writing the same program in that language?

That's probably true. But if PHP is the only language you know, it might still be worthwhile to learn another one, when you have some time to spare.

And "most mature"? Other web frameworks are plenty mature. Django, Rails and Spring MVC are all roughly 15 years old.

Re: PHP 8: Before and After

#288

Earlier quoted context omitted.

I haven't found any good arguments against PHP in the comments here, just pure hate. Let's name a few of the arguments people are making: 1. Its variables start with $ and that is ugly: I mean, come on, I won't even entertain this bigotry. 2. It used to be better before: This is just pure nonesense, before OOP PHP wasn't good to create any big and well-structured application, it is ironic because most of the bad opin…

You're not being fair to the argument #3. PHP is becoming a less good Java. That's the problem. It's like Java, except it doesn't have generics, doesn't have real data structures (List, HashMap, Deque), no threads or async, no method/function reference or typed function parameters, etc. So the whole "It's trying to be Java" is more like "What does it offer that's better than Java? Because Java has stuff that is bette…

PHP have nice libs as extensions for those data structures. It's std variants that should be avoided.

Re: PHP 8: Before and After

#289
post #230

One of the underappreciated pros of php for web development is its execution model, it's fault tolerant by default and shares little memory across requests. This kind of makes sloppy programming far more tolerable in php than in other platforms. In effect this has an impact on performance but it also helps in ensuring that a bad request can't blow out the whole application from serving other requests like is common i…

the largest performance issue i've come across with the execution model is that connection pooling is...well, pretty crap. opcache handles most of the other interpreted woes rather well.

Re: PHP 8: Before and After

#290
post #214

I don't really understand why in 2020 there's still this kind of blind hatred against this language. It often comes from horrible bad memories from previous versions or old frameworks. Objectively, compared to other languages i've been working with it is more than OK. Despite it's lack of "style" it is easy to understand, host, tests, diagnose and it is powerfull for web applications. I've been working on a SaaS API…

There is a discrepancy between what’s hip, and what’s actually used. On places like HN where everyone is in love with Ruby... errr... Go.... errrr I mean, Rust, you’d think that those languages are the what’s what. Then when you look at the job market, you get a very different picture of what actually gets used. In my country there hasn’t been a single job posting for all Rust in all of 2020. There’s been a single me…

That's quite strange. Rust is system level language.

Most web stuff need no memory management and can happily live with GC or even with giant memory footprint and reboot once a day.

Ruby is direct competition. One of two PHP major web frameworks borrowed everything they could from it. Even PHP is on Ruby bandwagon .... XD

Post reply on HN