While I was looking over some 3rd party code, and some extremely new code of my own. I discovered that I still use the leading underscore for private functions.

To be clear, I’m talking about this:

<?php

private function _foo(){
  //Hi there sailor!
}
?>

Not this:

<?php

private function foo_sailor(){
  //Hi there sailor!
}
?>

 

This is bad!

It comes from the old days where PHP 4 had no support for private nor protected methods. To compensate for this gap, PHP developers used the underscore to tell that it was a private function. It was like, DO NOT TOUCH THIS!
When developers weren’t totally at peace, thinking they made their point clear, they sometimes even did this:

<?php

/**private*/
/**private*/ function __foo() {
   //You can't touch this! Indeed, you can't touch this!
}
?>

As a lot of dev’s aren’t using this deprecated code style anymore, Zend continued to use it a long time. But for now, finally they decided it was time to move on. See here some screenshots from the Zend Coding Convention as the PSR convention:

http://framework.zend.com/manual/1.12/en/coding-standard.naming-conventions.html

Screen+Shot+2015-12-16+at+09.18.27

https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md#42-properties

Screen+Shot+2015-12-16+at+09.20.11

Well, I will continue to try not to use this old notation anymore. Might you see any in my code on Github or where ever in the world, send me an email, a smoke signal or for my part a post-dove and I will fix it!