Hacker News new | ask | show | jobs
by wvenable 5506 days ago
> The `once` distinction is a product of bad design and it only exists when you have a language that is both the templating (view) language and the processing language.

PHP takes it's cues from C -- that's where the idea of include() and require() come from. These functions pre-date the existence of OOP in PHP. There was a time when even the _once() functions didn't exist and you had to manage that yourself.

It's best to think of these functions as low-level building blocks you can use to build on your own abstraction layer. I never call those functions directly.

> The error handing should be done with exceptions.

PHP supports many styles of development. If you prefer errors, you can have those. If you prefer exceptions, you can convert all errors to exceptions with only a few lines of code (there is even a built in exception type for this purpose).