| 
	
 | 
 Posted by Don Freeman on 06/13/38 11:22 
"Andy Hassall" <andy@andyh.co.uk> wrote in message  
news:6ddde1pkd3ompg1j68u0k5avr6o8p6cp3c@4ax.com... 
> On Tue, 26 Jul 2005 22:09:42 GMT, "Don Freeman" <freemand@sonic.net>  
> wrote: 
> 
>>"include_once() should be used in cases where the same file might be 
>>included and evaluated more than once during a particular execution of a 
>>script, and you want to be sure that it is included exactly once to avoid 
>>problems with function redefinitions, variable value reassignments, etc.": 
>>---- 
>>So now I get to ask an extremely dumb question... 
>> 
>>Why would you include the same file multiple times in the same file  
>>anyway? 
> 
> Usually, when you want the output produced by that file printed multiple 
> times. 
> 
> stuff.php: 
> <?php print "The value is: $var<br>"; ?> 
> 
> index.php: 
> <?php 
> $var = 1; 
> include('stuff.php'); 
> 
> $var = 2; 
> include('stuff.php'); 
> 
> $var = 3; 
> include('stuff.php'); 
> ?> 
> 
Ok, my confusion arose from my practice of only using include files to  
contain functions that would be called by the script they are "included" in,  
my history is in legacy programming in which this is what include files are  
for. So far I have not used it for any code that is executed directly within  
the flow of the master script.   Therefore all my include statements are at  
the top of the master script as opposed to having them scattered throughout  
the document. 
 
Thanks for the clarification. -Don
 
  
Navigation:
[Reply to this message] 
 |