Re: require() problem

From: Date: Tue, 08 Aug 2000 02:45:00 +0000
Subject: Re: require() problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-10570@lists.php.net to get a copy of this message
Actually, that was my bad. The script reads the first time the variable ok (i guess switching from require to include since i'm using php4). But there's a second time that script is called in sequence and the variable is gone, that's why i'm getting that error. Thanks for replying though, now i know to use include when i need variables. :) -- André Fadel fadel@fee.unicamp.br Hoje E Sempre GUARANI! On Mon, 7 Aug 2000, Remco Chang wrote: > straight off the book "professional php programming": > > "<snip> Since the require statement is replaced with the contents of the > named file at compile time, it is not strictly speaking valid to use > require with a variable - the value of which cannot e known at compile > time. current versions of php4 effectively replace require with iclude > when used in this way, but it would be unwise to assume that this behavior > will remain the subsequent versions" > > hope this helps. :) > > ----------- > remco chang > bountyquest.com > > On Mon, 7 Aug 2000, Andre Fadel wrote: > > > I was just wondering if require will take variables instead of file > > names. I have this on my script: > > require($configfile); > > > > But I'm getting a error like this: > > Fatal error: Failed opening required 'config.inc.php3' > > (include_path='') > > > > Although the $configfile variable does not contain that, if i tell it to > > print $configfile right before the require statement, i get something > > different (the right stuff!!). > > > > So, what's the deal with that? What could be wrong? > > Thanks a lot! > > > > -- > > André Fadel > > fadel@fee.unicamp.br > > Hoje E Sempre GUARANI! > > > > > > -- > > 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 > > > > > >

« previous php.general (#10570) next »