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 Chris Hope on 05/11/05 10:31

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;
>
> 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)?

Only the one needed will be included in your script. Both include() and
require() work pretty much the same way except require() will produce a
fatal error if the file could not be included, whereas include() will
just show a warning on error.

I think the behaviour was changed from PHP4 on, as I'm pretty sure in
PHP3 require() included the file regardless of any conditional code.

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

 

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

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