Chris Fidao: PHP is Weird, Stateless, and Beautiful
- This topic is empty.
-
AuthorPosts
-
AbigailGuest
fantastic, long overdue commentary on PHP and why it’s (hated) awesome
AdamGuestJS gurus: the weirdo language! PHP sucks!
internet: ** shrugs **
AbigailGuestlol not just JS gurus, pretty much all the cool kids trash talk PHP….
JoshuaGuestChris also has a brief write up on this too:
PeterGuestLanguage 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!
LauraGuestyayyy PHP-FPM
KyleGuestSpoken like only a true PHP fan could speak haha
-
AuthorPosts