Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Can always have a look at this https://stitcher.io/blog/evolution-of-a-php-object

Latest code sample is at the bottom, covers a single specific use case (DTO) and it's still old as last update is november 2022.

PHP in general has managed to had great feature while cleaning up and keeping true to its mantra of "it should be simple and easy".

Modern PHP is super fun to use, and whether you like the verbosity and completeness of symfony, the "take a shortcut around the things you don't care so you can focus on your stuff" of laravel, the event based system of swoole or similar, the microframework like slim or just raw php, it's hard not to find a shoe that fit.

What's notably funny is how they managed to do that without breaking bc, and how that is perceived highly depend on who is reading. Take switch(). The original php version of it is rather terrible in what it does in term of "programming language correctness", but it worked and had its use. At the same time, a clean one that did what was needed was really wanted.

So instead of breaking every single software out there, making wordpress and company stuck on old version forever, they added a match(), which is a bit different and much cleaner. It's not really "the broken one and the good one", as their feature is different, but it's obvious that people who look for something bad will see that as terrible. In reality, you mostly don't use switch() in new code, but its behavior is fully described and documented.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: