[wp-hackers] prefix vs postfix - pros and cons

Charles K. Clarkson cclarkson at htcomp.net
Wed Feb 22 21:52:19 UTC 2012


On 2/22/2012 12:55 PM, Haluk Karamete wrote:

 > when building a framework of library  functions, and you need to make
 > sure your function and variable/constant names will not get mixed up
 > by people's custom code, which way would you go? prefix your
 > functions?, or postfix them?

You could use a PHP class with your custom functions in it. Use the
class name ...

bp_Custom_Functions::debug( $args );


... or use "new":

$custom = new bp_Custom_Functions();

$custom->debug( $args );


class bp_Custom_Functions {

     function debug( $args ) {
         wp_die( '<pre>' . var_export( $args, true ) . '</pre>' );
     }

     // ...
}


HTH,

Charles Clarkson
--
Mobile Home Investor
Free Market Advocate
Programmer

I'm not really a smart person. I just play one on the Internet.

Stephenville, TX
http://twitter.com/CharlesClarkson
+1 (254) 968-8328



More information about the wp-hackers mailing list