| 
	
 | 
 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] 
 |