Re: Embedded example code
| From: | Stig S. Bakken | Date: | Thu, 28 Mar 2002 22:40:08 +0000 |
| Subject: | Re: Embedded example code | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-5134@lists.php.net to get a copy of this message | ||
On Thu, 2002-03-28 at 22:09, Martin Jansen wrote:
> 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.
With all fairness due, if people can run the code in PHP, they can view
it in "less", but that's not the point.
- Stig