Re: __functions
| From: | Matthew Weier O'Phinney | Date: | Thu, 03 Mar 2005 04:02:59 +0000 |
| Subject: | Re: __functions | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17800@lists.php.net to get a copy of this message | ||
* Rob Agar <rob@wildlime.com>:
> just a quick 'un about function naming - the naming convention says
> that functions that begin with an underscore are to be considered as
> private to the class. What's the significance of beginning with two
> underscores? Is it supposed to differentiate between private &
> protected in c++ speak?
Double underscores are usually reserved for 'magic' methods and
functions -- __construct, __autoload, __set, __get, __call, etc --
methods that have special meaning to the PHP interpreter. I'm not a java
or c++ programmer, so I don't know if these have other traditional
meanings.
There's nothing saying you can't use double underscores for your own
purposes -- just be careful that your method name doesn't collide with
one of the magic methods.
--
Matthew Weier O'Phinney | WEBSITES:
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org
mailto:matthew@garden.org | http://vermontbotanical.org