You are here: Re: Loading of required data « PHP Programming Language « IT news, forums, messages
Re: Loading of required data

Posted by gosha bine on 08/02/07 17:47

Armando Padilla wrote:
> Hi everyone. heres a pretty newbie question ive have a script as shown
> below. My question is will the engine load up ALL the required scripts
> at run time OR will only the required scripts be loaded when entering an
> if statement. Not to answer my own question but i thought the php
> engine loaded ALL required files even if they are not being used at
> start up.
>
> /**********
> * PHP SCRIPT
> ***********/
> require("some file1.php");
>
> $x = 1;
>
> if($x = 1){

sure you mean $x == 1 (BTW to avoid this error in the future, take a
habit of writing a constant first : if(1 == $x)


> /* some code */
> require("some other file.php");
> }else{
> require("some other other file.php"); //Will this also load up in
> memory? even if it never is reached?
> }

php only includes files when the require/include statements are
executed, in other words

$x = 1;

if(1 == $x)
require("include this");
else
require("this-will-be-NEVER-included");




--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok

 

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

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