[thelist] To class or not to class in PHP
Ken Snyder
kendsnyder at gmail.com
Thu Dec 27 10:15:19 CST 2007
Stephen Rider wrote:
> ...
>
> myuniqueclassname::function1();
>
> So the question to the PHP gurus out there: is this a good idea or am
> I better off just prefacing my functions with something like...
>
> function myplugin_function1() {...}
>
> ...
>
Yes, stick with the class-based approach. Any performance differences
between class functions and global functions is trivial. Do what is
best for robustness and scalability and let the php-source developers
worry about performance. I also recommend using classes to store
variables and constants to avoid global variables as much as possible:
myplugin::function()
myplugin::$variable
myplugin::CONSTANT
- Ken Snyder
More information about the thelist
mailing list