20 ms·
PHP 8: Before and After
- skrebbel 6y agoThat first example brings back fond memories of Java 1.5 UI programming.
- vstm 6y agoWell it's a bit different, now the events are sent over the network and if you're using the term event-sourcing you can even consider yourself hip.
- Santosh83 6y agoWhen can we expect Wordpress to upgrade to PHP 8?
- arkitaip 6y agoVery soon: "A long-standing goal of the WordPress project is to be compatible with new versions of PHP on their release day. The next major version of PHP (version 8.0) is currently scheduled for release on November 26, 2020. WordPress Core contributors are working to ensure PHP 8.0 is supported in the next major version of WordPress (version 5.6), which is currently scheduled to be released on December 8, 2020." https://make.wordpress.org/core/2020/10/06/call-for-testing-php-8-0/ https://make.wordpress.org/core/2020/10/06/call-for-testing-...
- dragosmocrii 6y agoPossibly not what the author meant. Support for PHP 8 in WordPress will come soon after PHP 8 is released. But to upgrade WordPress to PHP 8, that is to rewrite its codebase to make use of PHP 8 features, probably will not happen anytime soon. WordPress still has a minimum PHP version requirement of 5.6, so...
- fogihujy 6y agoYeah, and just like in the case of Perl, PHP 5 isn't going away anytime soon; there's simply far too much legacy software running on top of it. The WordPress ecosystem, on the other hand, will probably make the switch much sooner.
- waheoo 6y agoAnd thank fuck for that. WordPress is the only web framework I've found that approaches stability of the Linux kernel. Backwards compat is important and maintained. Gutenberg hurt this a bit but it still does a great job of maintaining backwards compat. I take old wordpress websites and update them and everything just works. I take old laravel or code igniter or Drupal sites update them and everything just fucking falls over. Fwiw, most modern WordPress development is JavaScript / React based. PHP is just a backend glue language at this point for things like templating.
- CaptArmchair 6y agoIt's a blessing and a curse. Drupal 5/6/7/8 intentionally broke backward compatibility between versions in order to move the architecture and the feature set forward. The net result is that they are now at a point where Drupal could drop PHP 5 support. They also moved towards modern PHP / coding practices over the past years (Not invented here -> Proudly found elsewhere, composer, PSR's, OOP,...). WordPress stuck with preserving backward compatibility and so the core API's have never seen a fundamental breaking change between versions. New features have been tacked onto what was already there over time. I have kept a personal WordPress blog since 2005 and I have always been able to easily update things without migration pains. Of course, I run a minimum of customized code (beyond a custom theme that is). And I suppose YMMV and you still might have a different experience, if you did heavy customization through plugins, heavily leaning on WP's core API's. Drupal? Totally different experience. Breaking changes and fundamental alterations of the database schema have been par for the course. I've seen 6 month long migration projects to migrate crucial enterprise data between versions. The PTSD of migrating from Drupal 6 to 7 to 8 is real. Then again, WordPress and Drupal are different tools despite a significant use case overlap. I'd be weary to use either Drupal for a simple blog, or WordPress for an intricate, tailored back office application. I think they are both designed to do different things all together. Having said that, it's worth noting that the Drupal project is very aware of past pains. One of the big goals of the past few years was working towards avoiding big breaking changes between major versions. It is purported that migrating between Drupal 8 and 9 is far less painful. Of course, it remains to be seen how that holds up in the long term.
- brendt_gd 6y agoWP recently said they'll support 5.6 for an unknown amount of time. So not soon
- lillesvin 6y agoI'm not sure why you're asking or what new features you'd like them to take advantage of, but given PHP's reasonable approach to backwards compatibility, I expect that it won't take too much effort to get Wordpress running on PHP 8, but obviously it's not going to utilize much of the new stuff that way.
- viraptor 6y agoI'm not up to date on php code, but can't the first example be done using reflection? For example a SubscriberBase class which: lists all of its "on*" methods, checks if there's only one parameter, gets its type via https://www.php.net/manual/en/reflectionparameter.gettype.php https://www.php.net/manual/en/reflectionparameter.gettype.ph... and registers the method to receive events of that type. From the docs it looks like it's possible in php7 and doesn't need explicit text mapping. But maybe I'm missing something?
- philjohn 6y agoI'd need to check if this is still the case in PHP, but Reflection was orders of magnitude slower just a few short years go for cases such as ReflectionClass->methodExists() vs method_exists()
- viraptor 6y agoDoes it matter if you execute it only once per request?
- deleted 6y ago[deleted]
- francislavoie 6y agoDefinitely possible, but that's a bit "magic". It's nicer not to have to rely on methods being named exactly a certain way. There was a discussion on reddit about this exact same thing, shows that attributes lets you bind multiple events to the same listener more easily: https://www.reddit.com/r/PHP/comments/jgkp2r/php_8_before_and_after_stitcherio/g9r8edt/?utm_source=reddit&utm_medium=web2x&context=3 https://www.reddit.com/r/PHP/comments/jgkp2r/php_8_before_an...
- sdfhbdf 6y agoIt's becoming kind of an Enterprise language [1]. Don't get me wrong I think PHP is getting cooler, hopefully everybody catches up and the fact that You can have a shared hosting for pennies run Your PHP code really puts it at an advantage compared to others. [1]: https://github.com/joaomilho/Enterprise https://github.com/joaomilho/Enterprise
- dragosmocrii 6y agoLately I see myself abusing (???) types more often than ever. Before, I'd feel comfortable returning an array of structured data from a function. Now, I'm creating Value Objects to ensure my data is both valid and correctly used elsewhere. Kinda feels nice to get intellisense working too and knowing that the things that I'm trying to do with that VO are valid
- porker 6y ago> Before, I'd feel comfortable returning an array of structured data from a function. Now, I'm creating Value Objects to ensure my data is both valid and correctly used elsewhere. Same. I've written some complicated ETL/data transform processes in PHP, and used arrays because the array_* functions are so useful for manipulation. But keeping track of what keys were available was a nightmare - especially coming back to maintain the system. Like you I've switched to Value Objects. In many ways it's a pain (the intermediate representation that I'd stick into a new array key and pass to the next transformation - it doesn't belong on any of the objects; and PHP needs the equivalent of the array_* functions for objects) but knowing I can't use the wrong key somewhere makes it worthwhile.
- dkarlovi 6y agoPHPStan and Psalm support what they call "array shapes", basically you can treat the array keys as a type, similar to how TypeScript does it.
- thdrdt 6y agoBut your IDE could understand your code for years with: /* @return MyObject */ Returning an array with unknown items has always been bad practice imho.
- JekLod10 6y agoSo php tries so hard to be Java. Well, just stick with Spring and get the job done professionally. Learning PHP these days is a waste of time.
- cute_boi 6y agoTrue but the php syntax is way too bad (like $ etc) in comparison to Java.
- jonwinstanley 6y agoYou can’t build websites with Java
- formerly_proven 6y agoYou better go tell all those enterprisey Java websites they can't exist, they might just pop out of existence.
- jonwinstanley 6y agoHaha
- coldtea 6y agoThey might as well not exist
- gonzo41 6y agoIsn't Gmail built with Java and GWT? or was untill very recently?
- jonwinstanley 6y agoSure, you can build a website with anything really. I just bored of the hating on PHP when it continues to fit the web so well and some enormous percentage of sites are built in PHP.
- pietrovismara 6y agoSeriously, enough with PHP. Can we just let it die? I worked with PHP 5.6 years ago and I hated it. Recently I worked with PHP 7. Heard about all the work that's been done on it and I was kinda excited to try it. It's still so broken. It doesn't matter if they improve performance or add new cool features. PHP is broken in ways that can't be fixed without breaking compatibility. Fork it or put it out of its pain.
- AdrianB1 6y agoLive and let live. There is enough space in this Universe for you and PHP to coexist without interacting, if you don't like it then ignore it.
- pietrovismara 6y agoYeah that's mostly true, at least until you get a new job and only a few weeks in you find out they have a "small" years old service written in PHP that no one else wants to maintain :) That's my story, I ignored PHP for years but since I had to work again on it recently and got pretty quickly hit by its "rough edges" I couldn't help but ask myself why such a bad language is still around.
- Mikushi 6y agoBecause unlike "good" languages it generates revenue.
- sschueller 6y agoThe day you reach perfection is the day you finish your project as in never... PHP works (thought not perfect) lets me get things done.
- ptx 6y agoLots of languages work and let you get things done. You don't have to choose PHP.
- AdrianB1 6y agoI am not a developer, but by far most of the code I had to write in the past 5-6 years was in PHP. I see it going in a direction where it is no longer PHP, but trying to be something else it will never be (Java? C#?), so I may continue using it as long as it is backward compatible and that's it: good bye PHP, I am the same but you are not. I am not resistant to change, just the reasons I picked PHP versus something else are going away.
- fetbaffe 6y agoNothing is stopping you of writing PHP the "old" way, all new stuff is optional.
- wccrawford 6y agoOnly if you work alone. If you're in a team, you'll eventually have to start dealing with the new stuff.
- rawoke083600 6y agoI'm just going to come out and say it, and say it proudly ! 1) I love coding in PHP (I am a cs major) 2) I love riding scooters. There - internet be damned !
- kazinator 6y ago1) I love coding in PHP (I am a cs major) 2) I love riding scooters (I am a cs major) FTFY
- rawoke083600 6y agoHahah ok fine ! I accept it !
- lillesvin 6y agoNot a CS major, but PHP has been my preferred language for web stuff the last 20 years. Even way back it was just so damn easy to work with. Sure, I'll look to Go, Ruby, Crystal, Elixir and others for more specialized stuff, but plain and simple CRUD web stuff is what PHP is made for.
- rawoke083600 6y agoCouldn't agree more ! Ja Go is fun for "heavy lifting" but CRUD or "throwing something on the internet"... Give me my PHP :)
- stabbles 6y agoI'm glad you can now write: public static function new(): static { return new static(); } It really brings the point across it's static.
- brendt_gd 6y agoI know you're trolling, but FYI the `static` before function has nothing to do with the `static` return type. Like other programming languages the term `static` is used to denote two things.
- stabbles 6y agoThe term is overloaded, which is a bit unfortunate.
- hashtagmarkup 6y agoHowever, the unfortunateness is static.
- ThePadawan 6y agoAnd other programming languages get away wihout overloading the term. It's not an excuse for slacking on language design.
- int_19h 6y ago"static" itself is originally an overloaded term, and still remains such to this day in C++.
- joseluisq 6y ago> It really brings the point across it's static. A bit better, due from 7.x backward it really doesn't transmit any sense to me. Just confusion. And I'm not alone. See https://www.reddit.com/r/PHP/comments/elrnp4/rfc_for_static_return_type/ https://www.reddit.com/r/PHP/comments/elrnp4/rfc_for_static_...
- 6y ago
- jmnicolas 6y agoCan 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 fix a minor bug here and there). To be fair the app works OK and has done the job for all those years. This app has never been updated so it's PHP version 4 or 5 I think, it runs on an old Debian 5 VM, it's not facing internet, internal use only. It was supposed to be deprecated last year, but now given our budget (or lack thereof) and the sheer incompetence of our new provider I don't see it happening soon. Is there a way for me to have an IDE with a kind of "compiler" that would help me convert this to PHP 8 so I can migrate it on a more recent VM? Of course there's 0 budget for this.
- AdrianB1 6y agoIDE: Visual Studio Code with the PHP extensions, free. Compiler: you are looking in the wrong direction, PHP is interpreted. There were some compilers, but it's not what you need. Converting to PPHP 8: do you need that? what are you trying to achieve? You can keep the app another year or so it it is working, don't fix what is not broken. There is no way to convert to 8, you need to rewrite it, PHP become more object oriented with each version and that is a paradigm shift there is no converter for.
- Osiris 6y agoI was able to convert a PHP 5.4 app to 7.1 but after that there are too many backwards incompatible changes to be easy to fix. Even the upgrade to 7.1 took a few days of tweaks to the code. In my case the upgrade was demanded by security because the latest PHP5 release is no longer maintained. For an internal app you're much better off just leaving it on PHP 5. Maybe add an op-cache for performance.
- jmnicolas 6y agoI know PHP is interpreted hence my comment "to have an IDE with a kind of "compiler"". What I would like is an IDE experience: everything that isn't PHP8 compliant is underlined in red so I can fix the thing without launching the app every time and see if I broke something.
- thefounder 6y agoI didn't use PHP since ver 4-5. This looks like a different language. Even so I hope I won't have to use it again.
- stabbles 6y agoIt has a great package manager since then, a nice ecosystem, and deployment remains trivial too. There's still a use case for PHP.
- TheHemric 6y agoI 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 with Symfony now for 2 years, our metrics are good... It is a good tool, it builds good softwares It's essentially sinking in popularity because of bad faith and lack of hype, really sad !
- codegeek 6y agoThe funny part is that all the hate they have towards PHP, pretty much most languages have similar or other problems. I say this as someone who loves languages like Go, Python but I run a SAAS business in PHP which brings in close to 7 figures ARR and employs 15+ people. All these developers shitting on PHP are basically the elitist form of "I don't do PHP so you shouldn't either because it sucks and <my shiny language> is so much better".
- giantDinosaur 6y agoI know people who run decently sized and successful businesses in a variety of mind-numbing technology (try FileMaker scripting or shell scripting) but that definitely doesn't mean those things don't often suck and that there aren't advances in PL's that don't or won't lead to better software. (I personally don't use PHP at all because I haven't yet seen a reason to use it for any new projects over Python or TS. Is that new match expression proper pattern matching? ;)) It's pretty hard to draw a link between these things and commercial success, but it somewhat unseriously reminds me of Jonathan Blow's warnings that eventually everything is just going to fall apart.
- codegeek 6y agoYes I am not necessarily disagreeing. I am saying that people who shit on PHP think that other languages are somehow this magic wand that is so much better. I challenge the "so much better" part because the cost vs benefit matters.
- pornel 6y agoPHP picks up ideas and syntax from many other languages. I'm happy about it, because it popularizes and normalizes concepts that used to be niche or advanced. C established a lot of common syntax, and there's some consensus for post-C syntax emerging, like `name: type` syntax, `match` expressions, non-nullable types and operators for them. Nowadays `[1,2,3]` seems like an obvious syntax for array literals, but it wasn't obvious before JSON and other languages converging on it.
- gregoriol 6y agoA lot of those changes look like good things taken from other languages that have done it well (the null ?-> and ??, ...). But many things seem to be quite of a burden instead of a progress => why create a new match syntax when a switch is already well known for something similar? That will create confusion (thinking of all the for types of loops in JS!), plus it's still not an enum and cases will be missed. And the worst being the attribute #[] syntax... why?! Almost every other language uses @attribute, and it is successful: simple to write, easy to read, why on earth a new and such complicated solution? While php is making progress step by step, it has no chance of ever becoming of good reputation if it goes all the way to make itself more crazy.
- lifthrasiir 6y ago> And the worst being the attribute #[] syntax... why?! Almost every other language uses @attribute, and it is successful: simple to write, easy to read, why on earth a new and such complicated solution? Simple, it was already taken up [1]. Also `@attribute` syntax is by no way universal (and semantics wildly vary even with the same syntax): `#[]` in particular might have been inspired by Rust. [1] https://www.php.net/language.operators.errorcontrol https://www.php.net/language.operators.errorcontrol
- gregoriol 6y agoThe rfcs have a lot of discussion on those subjects indeed, but I still disagree with the choice! Also, the current use of @ is before a function call or some get, not before a method/class/... declaration, so a change in that direction would probably be possible. (plus the @ to suppress errors should probably be removed from the language anyway!)
- IluTov 6y agoIt's not possible because PHP has a LALR(1) parser but this would require arbitrary lookahead.
- deergomoo 6y ago> And the worst being the attribute #[] syntax... why?! Hah. Since the initial RFC was agreed, I think there were three changes to the syntax because no-one could agree. At one point it was going to be `@@attribute`. #[] is similar to or the same as Rust, I believe. It also has the advantage of being backwards compatible; while rarely used, comments in PHP can start with # instead of //, so older versions of PHP will just see an attribute as a comment. Of course, that also means that a comment in old code might now be interpreted as an attribute, but there you go. Single @ is probably a no go because @ is already the error suppressing operator. Now, in my opinion that should be ejected from the language with extreme prejudice, but I doubt it ever will be.
- js4ever 6y agoFew months ago I was debating with a friend working since 15 years on PHP, my point was php is slow and max throughput is 200-500 rps, which is quite low compared to Go, node.js, C# and others, he answered that 100-200 request per second is more than enough for most use cases. I'm working on systems with 25K RPS at peaks, but for simple projects and small companies he is right ... But why should anyone start a new project in php now that we have so many good alternatives?
- codegeek 6y ago"he answered that 100-200 request per second is more than enough for most use cases" Exactly this. If you already know PHP and can produce results (mostly CRUD apps) and it doesn't need millions of rps, why do we need to use another language because they are so much better ? So much better at what ? It is like saying "I have a hammer, so everything looks like a nail to me". Not every web app has to be written in Lua/Rust/Go/Julia etc. Each language comes at a cost. No free lunch. "But why should anyone start a new project in php now that we have so many good alternatives?" Because everything comes at a cost. You want to use Rust instead of PHP ? Sure, sounds great. Now lets go find a really good Rust developer who also understands how to host it correctly and then if he leaves, can I easily find another Rust developer ? Hmmm. You also need to account for maturity, ecosytem, hosting, maintenance etc which are all real world problems. Building a new shiny toy project ? Go ahead use whatever language you love. Again, it is about cost vs benefit.
- codeulike 6y agoReminds me of "PHP Hammer" I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there. You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes. You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways. You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever. And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools. Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door. That’s what’s wrong with PHP. https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/ edit: Flickr user @raindrift made an actual PHP hammer, famously https://www.flickr.com/photos/nicoletbn/6949293600 https://www.flickr.com/photos/nicoletbn/6949293600 2012 discussion of hammer https://news.ycombinator.com/item?id=3866488 https://news.ycombinator.com/item?id=3866488 TechCrunch defence of the hammer https://techcrunch.com/2012/07/28/not-that-kind-of-filthy-get-your-mind-out-of-the-gutter/ https://techcrunch.com/2012/07/28/not-that-kind-of-filthy-ge...
- slifin 6y agoLet's hope this takes off: https://github.com/abertschi/graalphp https://github.com/abertschi/graalphp
- ai_ja_nai 6y agoI don't understand as of 2020 the use case for PHP. It's verbose as Java without its speed. Seriously, can anybody help here? It made sense to use PHP EXACLTLY in the good bad old days because it was just leaner to bang out applications in PHP than with other languages. Nowadays, I feel that PHP cake has been largely eaten by Python and Ruby. Why using PHP with such a level of verbosity?
- iDemonix 6y agoSee the comment by TheHemric, it's a bit more informed than you seem to be.
- ai_ja_nai 6y agoUhm >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 with Symfony now for 2 years, our metrics are good... >It is a good tool, it builds good softwares Informed? These are opinions, dude. Where are the objective arguments? "It is ok, works for me" is not "being informed"
- mknx 6y agoI converted about two dozens Ruby and Python apps to PHP in the last 7-8 years.
- ai_ja_nai 6y agoI don't know what to say in response. Conciseness is a valuable property which, for web development, PHP seems to have given up.
- psychoslave 6y agoThis single sentence horrified me more than the whole terrorist attacks over the last 26 years (before that, there was no PHP).
- psychoslave 6y ago8 years after the publication of the famous "PHP: a fractal of bad design", has PHP overcome any of the point raised in this article? https://www.pixelstech.net/article/1334166417-PHP%3A-a-fractal-of-bad-design https://www.pixelstech.net/article/1334166417-PHP%3A-a-fract...
- SergeAx 6y agoPlease remember that PHP is more or less the only truly free (as freedom) community driven language suitable for both prototyping/pet projects and enterprise grade web software development. TypeScript and C# are Microsoft, Go is Google, Java is Oracle. Python is not suitable for complex multi-layered systems, Rust is too young and let's see where it will go without Mozilla. Ruby? IMO Ruby is in sunset phase, no new ambitious projects are started with Ruby.
- asmosoinio 6y ago> Python is not suitable for complex multi-layered systems For example what?
- SergeAx 6y agoIt is too loose typed and it's implementation of interfaces is too relaxed to use complex software engineering patterns and methodologies like DDD and SOLID.
- andrekandre 6y ago> it's implementation of interfaces is too relaxed as someone only casually used to python im curious how so?
- SergeAx 6y agoIt only has duck-typed interfaces, unable to verify methods' signatures. Trying to implement strong inheritance leads to monstrosities __instancecheck__ and __subclasscheck__ and manual type checking of injected dependencies.
- darkstar_16 6y agoYeah, really interested to know why ?
- sullyj3 6y agoHaskell is very free, and very suitable for complex systems!
- deleted 6y ago[deleted]
- somurzakov 6y agoPHP is a perfect language for webdev and automation: much faster and lightweight than python, good package ecosystem. I do all my process automation tasks in PHP and it's been such a pleasure.
- jjice 6y agoIt's situations like that where I'd like a way to write <?python And dump some python code the same what you'd do php and have my web server serve it up. It would be handy, but I'm sure the uses cases are limited.
- ralph87 6y agoThis style of embedding was popular at one point in Python's evolution before Django appeared. You can probably find 10 such systems in this list: https://wiki.python.org/moin/WebFrameworks#Discontinued.2FInactive_Frameworks https://wiki.python.org/moin/WebFrameworks#Discontinued.2FIn... There are probably a few still around
- dotancohen 6y agoIf you are sufficiently motivated, you might look into Emac's "babel" scripts, which can run Python embedded in org-mode files. You could use mod_wsgi in Apache to set your .pml (Python Markup Language, I just made that up) files to be parsed.
- acomjean 6y agoI too use php for automation. It has a lot of "built ins" that are always there (reading csv files for example/ json reading), which I find makes things a little easier for a lot of simple things. if i have to crunch numbers in a script I like R, or Python w/ Pandas
- aszen 6y agoOne 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 in platforms like nodejs where you need to be extra careful. Needless to say this makes php becomes quite viable for production envs, and prevents a whole host of issues that need expertise and careful programming to fix.
- newhouseb 6y agoI'm thankful to have started programming in PHP when I first started doing web work for this reason. Shared mutable state is (almost always) bad and virtually everything I've built after that (on any stack) follows similar rules around per-request isolation because of the patterns PHP instilled in me. Not only does this reduce (1) the likelihood of correctness issues, but it also dramatically reduces (2) deployment complexity because you don't need to migrate a bunch of in-memory state distributed across web backends. Your servers should all be considered dispensable. In 2020, I tend to bias towards things like AWS lambda for this reason (for low volume applications). By default, there's no guarantee on the lifetime of the serving process and any unhandled exception recycles the process so you're never in an unknown (bad) state. There are of course performance downsides to this (particularly when it comes to pooling connections for things like Postgres), but once you figure that out things are generally smooth sailing.
- NationalPark 6y agoPHP apps following modern best practices usually include stateful middleware of some kind though, so this applies in theory more than in practice.
- zapt02 6y agoIf 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.
- ausjke 6y agoWhile I used drupal heavily then switched to wordpress for all sites I do, I'm now using golang instead. PHP is good at what it does, but its usage is in decline over recent two decades, actually, if without wordpress's installation, its relevance might be very very limited if anything at all these days.
- ausjke 6y agoA quick job search on indeed.com based on coding language: Java 32K Javascript 30K Python 23K C 10K C++ 10K PHP 5K Go 3K Rust 500
- deleted 6y ago[deleted]