I'm writing a very simple library (just a few functions, really), and I don't want to pollute the global space. E.g. my library is:
function helper () { ... }
function interesting () {
...
helper();
...
}
I want interesting()
to be visible when loading the file with include
, but not helper()
.
It seems to me that it's not possible (there's no such thing as a local scope in PHP), unless I use a class with private variables, or a namespace, but both solutions feel like overkills to me in this case. So, what is the recommended way to avoid polluting the global space?