Simple script wont work with PHP4 (but works with PHP5)


I have developed a dynamic image viewer with PHP and Flash on my computer, running PHP5 on my local apache server. Now that I have transferred the site to a webhotel, running PHP4.x, the PHP wont return an array with the images anymore. Here is the code:

$dir = opendir("controlroom/");
while ($file = readdir($dir)) {
if ($file=="." or $file=="..") continue;
$string.= $file;
$string.= ", ";
echo "imgList=".$string;

Running the php-file on my own server (PHP5), this is what I get in return:


That make’s my image gallery properly load the array, but when I run the same PHP file on the webhotel (PHP4.x), this is the return:

Notice: Undefined variable: string in C:\Inetpub\wwwroot\projekt\sidor\web_site\img\studio.php on line 5

The array is now undefined. Won’t my code work with PHP4, or can there be anything else that’s wrong?

This is the flash code for taking in the array, if it can help…
[AS]lvStudio = new LoadVars();

lvStudio.onLoad = function(success) {
    if (success) {
        studioArray = this.imgList.split(", ");

//else {trace(“could not load file”) }

/henrik, sweden