[wp-hackers] prefix vs postfix - pros and cons
Michał Środek
michal at srodek.info
Thu Feb 23 04:46:35 UTC 2012
Hello,
remember that PHP( >=5.3 ) has already namespaces (
http://php.net/manual/pl/language.namespaces.php ). Unfortunately php
5.3 is still not so popular so I prefer prefixes.
Michał
2012/2/22 Charles K. Clarkson <cclarkson at htcomp.net>:
> 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
>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
More information about the wp-hackers
mailing list