I want to create a file-static variable in PHP. How can I do this or what should I use instead?
Edit:
I'm basically wanting to create a file-scope static variable, similar to what is available in C/C++.
I want to create a file-static variable in PHP. How can I do this or what should I use instead?
Edit:
I'm basically wanting to create a file-scope static variable, similar to what is available in C/C++.
You can take a look at namespaces. Available only in PHP >=5.3 http://www.php.net/manual/en/language.namespaces.rationale.php
After further investigation, it seems like the easiest solution is to just use a class which wraps the functions. The only downside is you have to use the prefix when calling: Container::Func();
This could be solved with an additional wrapper for each function, but this isn't as clean of a solution.