- This topic is empty.
-
AuthorPosts
-
October 5, 2023 at 10:52 pm #8412
Abigail
Guestfantastic, long overdue commentary on PHP and why it’s (hated) awesome
October 5, 2023 at 10:54 pm #8413Adam
GuestJS gurus: the weirdo language! PHP sucks!
internet: ** shrugs **
October 5, 2023 at 10:54 pm #8414Abigail
Guestlol not just JS gurus, pretty much all the cool kids trash talk PHP….
October 5, 2023 at 10:55 pm #8415Joshua
GuestChris also has a brief write up on this too:
October 6, 2023 at 10:51 pm #8426Peter
GuestLanguage Comparison
In the video, we compare other popular languages and see how its possible to create a global variable that increases in value with each web request. In other words, there’s global state that that you need to worry about.PHP is different – even global variables are “reset” to their initial value on each request. (This is not to be confused with super globals such as $_GET, $_POST, $_SERVER, and so on).
Pros and Cons
This makes PHP much easier to use – the mental model of what your code is doing is much simpler when there’s no state that might be accidentally saved between web requests.However it also means we need to reload a lot of code on each web request. This is alleviated by PHP’s opcache, but it’s still not as efficient as having the framework/code loaded already when accepting a new web request.
Additionally, PHP can’t make use of things like connection pooling – each web request instead needs to make a whole new connection to databases, caches, and other external services.
This, luckily, is mostly just fine – PHP is still fast!
October 6, 2023 at 10:57 pm #8427Laura
Guestyayyy PHP-FPM
October 15, 2023 at 7:16 pm #8525Kyle
GuestSpoken like only a true PHP fan could speak haha
-
AuthorPosts