You are here: Re: including files « PHP Programming Language « IT news, forums, messages
Re: including files

Posted by Michael G on 08/14/05 00:50

"Michael G" <mike-g@montana.com> wrote in message
news:1123965731_1225@spool6-east.superfeed.net...
>
> "Michael G" <mike-g@montana.com> wrote in message
> news:1123965413_1221@spool6-east.superfeed.net...
>>A habit of mine is to include all files at the head of the file requiring
>>them.
>> Is the following bad practice? It works just fine but...???
>>
>> thanks, mike
>>
>> class ActionFactory
>> {
>> function createAction($className)
>> {
>> $className = $className.'Action';
>>
>> include_once 'action/'.$className.'.php';
>>
>> return new $className;
>> }
>> }
>
>
> It seems like this would cause some scope problems?
>

from http://us2.php.net/function.include
When a file is included, the code it contains inherits the variable scope of
the
line on which the include occurs. Any variables available at that line in
the
calling file will be available within the called file, from that point
forward.
However, all functions and classes defined in the included file have the
global scope.



----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация