You are here: Re: how does php parse actually this? « PHP Programming Language « IT news, forums, messages
Re: how does php parse actually this?

Posted by Hans van Kranenburg on 05/13/05 03:41

Hans van Kranenburg wrote:
> chotiwallah wrote:
>
>>suppose i have the following code:
>>
>>switch ($inc):
>>case 0:
>> require 'inc0.php';
>> break;
>>case 1:
>> require 'inc1.php';
>> break;
>>case 2:
>> require 'inc2.php';
>> break;
>>endswitch;
>
>
> This doesn't exactly look like php...
>
>
>>question: does php actually include and parse all 3 files, or just
>>the one needed (isuppose so, but i'm not sure)? how does that
>>influence performance (each inc is about 40k)?
>
>
> Just read the documentation:
> http://nl.php.net/manual/en/function.require.php
>
> Note: Prior to PHP 4.0.2, the following applies: require() will always
> attempt to read the target file, even if the line it's on never
> executes. The conditional statement won't affect require(). However, if
> the line on which the require() occurs is not executed, neither will any
> of the code in the target file be executed. Similarly, looping
> structures do not affect the behaviour of require(). Although the code
> contained in the target file is still subject to the loop, the require()
> itself happens only once.

Uhm... sorry, this is not exactly the right quote... :P Anyway,
including all files whether they are on a line of code that will be
executed smells like asp behaviour, and the above makes clear that PHP
doesn't act like that anymore since 4.0.2

--
"He who asks a question is a fool for five minutes;
he who does not ask a question remains a fool forever"

 

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

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