Re: include and require

From: Date: Sun, 02 Jul 2000 04:27:15 +0000
Subject: Re: include and require
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-4355@lists.php.net to get a copy of this message
heh. This time i read your question and will give you an answer :) Sorry about that last post which didn't answer your question. Take this example: $mything = 1; if ($mything) { include("myfile.inc"); } In this example the file "myfile.inc" will ONLY be included if the var $mything = 1. So if we change $mything = 0 then the file "myfile.inc" will NOT be included. This second example uses require() instead of include(): $mything = 0; if ($mything) { require("myfile.inc"); } This time the file "myfile.inc" will be parsed (aka included) into the into the main script if $mything = 1 OR if $mything = 0. In the second example above if we change the require() back to an include() then "myfile.inc" would NOT be included because the if statment tests false. Hope this helps. -- Scott On Sun, Jul 02, 2000 at 07:11:13PM +0700, Eris Ristemena wrote: > hi all, > i read in the manual many times but still i cannt figure out when we use > include() and require() ? > any suggestion will be well appreciate. > > - eris > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- Scott

« previous php.general (#4355) next »