Re: Embedded example code
| From: | Martin Jansen | Date: | Thu, 28 Mar 2002 21:09:03 +0000 |
| Subject: | Re: Embedded example code | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5133@lists.php.net to get a copy of this message | ||
On Thu, 28 Mar 2002 19:40:52 -0000, Richard Heyes wrote:
>class My_Class {
>
> ...
>
> function example(){
> // ...example code
> }
>}
>
>if(basename($HTTP_SERVER_VARS['PHP_SELF']) === basename(__FILE__)){
> My_Class::example();
>}
>
>Any thoughts regarding it? Possible problems I see are:
Apart from the performance waste that you've already mentioned,
I think that it is generally better to put proper examples in
the documentation of your code and not in the code itself.
Always remember that a lot of people who use PEAR don't have
access to the class files, since they are installed somewhere
(/usr/lib/php) on their hosting environment - this people
will then not be able to read your example code.
-1 from me on this idea.
- Martin
--
Martin Jansen, <mail@martin-jansen.de>
http://www.martin-jansen.de/