PHP General List,

I am trying to read the contents of a directory on a server and perform imagemagick operations on each JPG found inside the directory. The area where I am stuck currently is not the image manipulation but the PHP function readdir().

Can anyone explain why I am having this behavior with PHP using the scripts out of the manual pages for readdir()

Hereis my script, I copied and pasted Example 1 from this page:

http://us4.php.net/manual/en/function.readdir.php


You will see that the only way that I changed I initialize two variables at the very top that set the directory of the directory to open. The script should read the contents of the directory and print them to the resulting page.


Instead, it returns a the following parse error

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /Users/jason/Sites/images_exotic/REDESIGN2 FALL 04/admin/check_set_local.php on line 4


I see this PHP behavior on both Windows Server running PHP 4.3.2 and on my own Mac (OS X client) running apache as a "Personal Web Sharing" PHP version 4.3.6


Any help is appreciated. The contents of the script which I cannot get the parse error out of is below.

On this vein, can anyone tell me a succinct explanation of the bang-equal-equal (!==) operator in contrast to the bang-equal (!=) operator?

I've never seen that before, is it borrowed from other languages? I do not remember it from when I was learning C++.

Thanks.
-JFB-




<?php // Note that !== did not exist until 4.0.0-RC2

$root_dir = "/Users/jason/Sites/";

$folder_on_server "test";

if ($handle = opendir($root_dir . $folder_on_server)) {
    echo "Directory handle: $handle\n";
    echo "Files:\n";

     /* This is the correct way to loop over the directory. */
     while (false !== ($file = readdir($handle))) {
        echo "$file\n";
    }

     closedir($handle);
 }
?>






Reply via email to