Tips

In order to write future-proof code, it is recommended that you prefix (or suffix) anything that goes into the global namespace with an uncommon 3-4 letter prefix (or suffix) separated with an underscore. It is recommended that in order to prevent namespace clashes with other userland code that projects research existing prefixes (or suffixes) used in other projects and advertise their chosen prefix (or suffix) appropriately. Examples:

  • MyPx_someFunc()

  • Foo_Date

  • $asdf_dbh

Коментарии

I don't think it makes sense nowadays. We have namespaces now!
2013-07-19 19:31:54
http://php5.kiev.ua/manual/ru/userlandnaming.tips.html
@willian at gt44 dot com: What about clashes of the namespace?  It is still good advice to check for previously used names before assigning anything to the global namespace.
2014-01-30 17:46:18
http://php5.kiev.ua/manual/ru/userlandnaming.tips.html
The javascript community has developed a strong cultural bias against adding anything to the global namespace.  (See e.g. Addy Osmani's article on Essential JavaScript Namespacing Patterns .)  Namespaces have been available in JS for many years and are ubiquitous.  There is also a great deal of freely available tutorial material for the interested reader.
2014-06-07 21:10:36
http://php5.kiev.ua/manual/ru/userlandnaming.tips.html
Even though nowadays we do have namespaces, for the cases in which the user chooses to not use namespaces theses tips should be followed.
2014-09-21 05:48:24
http://php5.kiev.ua/manual/ru/userlandnaming.tips.html

    Поддержать сайт на родительском проекте КГБ