5 ms·
PHP apps following modern best practices usually include stateful middleware of some kind though, so this applies in theory more than in practice.
by NationalPark 6y ago
PHP 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.
- NationalPark 6y agoNo, I'm talking about the kind of thing that provides a `Context`-like object that allows the application developer to share memory between requests.
- jozzy-james 6y agothat's not really a thing you do in PHP, outside of frameworks like swoole/roadrunner. by nature it's a fire/execute/die shared-nothing model
- pampa 6y agoyou mean $_SESSION? that was there since at least php4
- mkopinsky 6y agoAnd even that is limited to sharing data for a single user between requests. It's hard to accidentally share data between users.
- zapt02 6y agoLike others have mentioned, there is no such thing in PHP. Each request is handled individually from a blank slate and the context is destroyed when the request finishes.
- wolco2 6y agoWrite to a database or file?