If you are using php version <5.3 (and you probably cannot use namespaces) than you could use something like:
<?php class Foo { public static function aStaticMethod() {
(copied from php manual )
I would say that this is a class function in a sense - a grouping of functionality.
This will not have performance problems (you could do it millions of times, and you wonโt even notice - there should be no time spent on launching, only a small additional cost of parsing, and this is insignificant). Modern php frameworks bring in a lot of codes and internally create a lot of objects - I would not worry about php performance, database performance almost always affects you in the first place. Make sure your code is readable and supportable (yes, especially php code;)), and if that means the grouping functions are running, then do it.
"97% of the premature optimization time is the root of all evil," especially when you make web pages, not nuclear simulations;)
Edit: public and static are only php5, in php <5 you can try:
<?php class Foo { function aStaticMethod() {
source share