PHP Coding Tips

Tuesday, August 7, 2012

Organize your global functions to static methods - alternative to structural/procedural programming

If you are not into Object Oriented Programming, and include files and functions everywhere, you can get lost in your own function names. The good alternative is to group your functions into classes with static methods:class UserModule { public static function getUserId() { ... } public static function removeUser( $id ) { ... } } UserModule::removeUser( 11 );

No comments:

Post a Comment