Re: unexpected include parse error

From: Date: Tue, 27 Jan 2004 05:49:51 +0000
Subject: Re: unexpected include parse error
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-175856@lists.php.net to get a copy of this message
Shawn McKenzie wrote:
I've noticed in both of your posts that you aren't terminating the line before the include with a ;
Yup, thanks! Then I fixed my global problem without bugging you guys too. Final result: #call.php $dirstr= "./"; include 'scandir.php'; scandir('$dirstr'); #scandir.php function scandir($dirstr) {
     global $dirstr; #I HAD TO ADD THIS LINE ALSO
     $files = array();
     $fh = opendir($dirstr);
     while (false !== ($filename = readdir($fh))) {
         array_push($files, $filename);
     }
     closedir($fh);
     return $files;
}
FYI... If you use / then you don't have to escape it like // only the \. Also, instead of ".\\" you can use '.\'
Ah ha! that explains my confusion :-)

« previous php.general (#175856) next »