Re: include_once("blah"); vs $blah="blah"; include($blah);

From: Date: Wed, 12 Jun 2002 00:11:03 +0000
Subject: Re: include_once("blah"); vs $blah="blah"; include($blah);
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-101647@lists.php.net to get a copy of this message
is your isp using a unix machine or windows machine? if they are using a unix box then your backslash needs to be a forward slash "/", and if they are using a windows machine, your backslash needs to be escaped. --> "\\" other wise you are escaping the "b" in blah... Jim Lucas ----- Original Message ----- From: "Martin Towell" <martin.towell@world.net> To: "'Henry'" <henryg@markiteer.com>; <php-general@lists.php.net> Sent: Tuesday, June 11, 2002 4:31 PM Subject: RE: [PHP] include_once("blah"); vs $blah="blah"; include($blah); > if that's a direct copy of what you've got, then the parse error's probably > to do with the "var" and not the "include_once" > > "var" is used only in classes... > > -----Original Message----- > From: Henry [mailto:henryg@markiteer.com] > Sent: Tuesday, June 11, 2002 11:11 PM > To: php-general@lists.php.net > Subject: Re: [PHP] include_once("blah"); vs $blah="blah"; > include($blah); > > > I did as you suggest with an interesting result: > > include_once "blah.php"; > > worked > > var $blah="blah.php"; > include_once $blah; > > gave the following error: > > Parse error: parse error in <including file> on line <line number> > > > Where the <including file> is the file that was doing the include! > > > > Previously include_once($blah) just messed up the scoping and global vars! > > Henry > > "Jonathan Rosenberg" <jr@tabbysplace.org> wrote in message > news:NDBBLKBKIKFIPIFMDDNHIEEGGAAA.jr@tabbysplace.org... > > Out of curiosity, try > > > > <?php > > global $root; > > $blah="include\blah.php"; > > include_once $blah; > > ?> > > > > & see if it behaves differently (i.e., no parens around the > > include file name). > > > > > -----Original Message----- > > > From: Henry [mailto:henryg@markiteer.com] > > > Sent: Tuesday, June 11, 2002 8:15 AM > > > To: php-general@lists.php.net > > > Subject: [PHP] include_once("blah"); vs $blah="blah"; > > > include($blah); > > > > > > > > > My web hosting company is running php 4.0.4pl1 > > > > > > Why should it be that these are different > > > > > > <?php > > > > > > global $root; > > > include_once("include\blah.php"); > > > > > > ?> > > > > > > and > > > > > > <?php > > > > > > global $root; > > > $blah="include\blah.php"; > > > include_once($blah); > > > > > > ?> > > > > > > When I say different I mean; > > > > > > 1) global variable are not avaiable in the second version > > > 2) functions defined in the included file are not > > > accessable in the > > > including file. > > > 3) in both examples the file is included, its just the > > > scope that seem shot > > > > > > Any answers? > > > > > > Henry > > > > > > > > > > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#101647) next »