Re: Classes - Dumb question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 15 October 2007, Nathan Nobbe wrote:
> On 10/15/07, tedd <tedd@xxxxxxxxxxxx> wrote:
> > I understand the class concept. But, I am not familiar with autoload.
> >
> > Stut also made mention of that, so I shall investigate post haste.
>
> __autoload is pretty tight; but if you dont want to have all your class
> files in the same
> directory, i suggest you implement something custom.
> ive seen several implementations where class names basically have
> filesystem paths
> embedded in them; ugh..  i think thats what those buxa project guys are
> doing, but im
> not certain.
> also, the __autoload() function has to be available for it to be called,
> which means you
> will have to include the file that defines it in every file that would use
> it.  since my php
> code is heavily oop; i just use the php.ini auto_prepend_file directive.
> oh; btw, Tedd, autoload is for classes only; if you like what you see maybe
> that will be
> the excuse youve been looking for to get into oop w/ php :)
>
> -nathan

__autoload() is also not recommended. :-)  You can only have one per script.  
Instead, use spl_autoload_register().  That way you can stack multiple 
autoload routines cleanly.

(At least that's what the php-internals folks were saying the last time the 
topic came up.)

http://us2.php.net/manual/en/function.spl-autoload-register.php

-- 
Larry Garfield			AIM: LOLG42
larry@xxxxxxxxxxxxxxxx		ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux