This is just my temporary blog till I create my own on my site, one that actually counts statistics (posts, profile views, etc) correctly.

Location: Colombo, Sri Lanka

There's way too much to type.


Function naming convention

If you work with functions, then, this is for you!

Consider this case:

Your name is P.H.P. McCoder and you work as a web scripter in the year 2004 and your web scripting language of choice is PHP4.
Here's a snippet of a class that you wrote for project-X

class Koobi
function Koobi($parameter)

function clone($value)
return $this->doClone($value);

It works fine with PHP4.

It's now the year 2005. Your host decides to upgrade to PHP5 and (this is all hypothetical) PHP5 has a new function added to it. And guess what? The new function is named clone().
What happens when your class method is called? You recieve parse errors!

The people over at PEAR have a nice suggestion for a naming convention for functions.
I suggest you take a look, otherwise, like me, your users might end up using the "search and replace" function.


Post a Comment

<< Home