close

May 2024 only! Join our Discord free of charge.

Slick­Stack
Lightning-fast WordPress on Nginx

Chris Fidao: PHP is Weird, Stateless, and Beautiful

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #8412
    Abigail
    Guest

    fantastic, long overdue commentary on PHP and why it’s (hated) awesome

    #8413
    Adam
    Guest

    JS gurus: the weirdo language! PHP sucks!

    internet: ** shrugs **

    #8414
    Abigail
    Guest

    lol not just JS gurus, pretty much all the cool kids trash talk PHP….

    #8415
    Joshua
    Guest

    Chris also has a brief write up on this too:

    https://fideloper.com/php-weird-stateless-and-beautiful

    #8426
    Peter
    Guest

    Language 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!

    #8427
    Laura
    Guest

    yayyy PHP-FPM

    PHP-FPM

    #8525
    Kyle
    Guest

    Spoken like only a true PHP fan could speak haha

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Thanks to our generous sponsors for their support!