php developer
›
Hiveminds Magazine: Using numbers in PHP function names
In PHP, function names have to start with either an underscore or some alpha-numeric character. Most developers, however, choose just the underscore (more recently, especially in PHP5 applications) and an alphabet character - no numbers. In this new post from Hiveminds magazine, hoever, they suggest a different approach to naming conventions for your functions/methods.
There is a problem with using procedural code in PHP. If you have hundreds of functions then you are going to run into naming problems after a while. In PHP function names not protected by OOP classes have to have unique names. This is no problem if you are not using a hook system like that of Wordpress or Drupal. These CMS are coded using the underscore character as a designation for a hook system. This "hook_action" is an example.
Well as the project grows and becomes more popular then you start running out of humanly understandble words and letters to use. That or the names become too long to be remembered during normal development. So why don't developers use numbers in the name of their functions?
The author suggests that numbers can be more memorable than just named functions and can even help to seperate them into a kind of namespace within the application. There's a bit of code that shows how to, with his naming convention ("tying the knot"), check to see if a module implements a hook.
He also notes how using a system like this can help run your code of those pesky conflicts between function names that can happen when integrating 3rd party applications.