Re: unexpected include parse error
| From: | Shawn McKenzie | Date: | Tue, 27 Jan 2004 05:18:25 +0000 |
| Subject: | Re: unexpected include parse error | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-175851@lists.php.net to get a copy of this message | ||
I've noticed in both of your posts that you aren't terminating the line
before the include with a ;
That would probably help.
FYI... If you use / then you don't have to escape it like // only the \.
Also, instead of ".\\" you can use '.\'
-Shawn
"Paul Furman" <paul@edgehill.net> wrote in message
news:20040127045925.86735.qmail@pb1.pair.com...
> David Obrien wrote:
>
> > the \ has to be slashed
> >
> > ".\\";
>
>
> Ah great, thanks! that fixes most of the errors. The following runs
> where I define the $dirstr in the function but if I try to define it in
> the page that calls the function, it still gives
>
> Parse error, unexpected T_INCLUDE in [#call]
>
>
> #call
> $dirstr= ".//" this is where I want to define the directory
> include 'scandir.php';
> scandir('$dirstr');
>
>
>
> #function
> function scandir($dirstr) {
> $files = array();
> #$dirstr=".//";
> $fh = opendir($dirstr);
> while (false !== ($filename = readdir($fh))) {
> array_push($files, $filename);
> }
> closedir($fh);
> return $files;
> }
>
>
> PS I'm on my windows apache server but the forward slash seems to work
> in php & that keeps it portable. I tried it both ways.