<?php $dirstr= "./" include 'scandir.php'; scandir('$dirstr'); ?>
parse error, unexpected T_INCLUDE in [the above file]
if I comment out the
$dirstr= "./"
above that error goes away and the scandir.php include runs (that's a php5 function that needs to be defined manually in PHP 4.3.4)
#scandir.php <?php #$dirstr=".\"; function scandir($dirstr) { $files = array(); $fh = opendir($dirstr); while (false !== ($filename = readdir($fh))) { array_push($files, $filename); } closedir($fh); return $files; } ?>
If I set $dirstr=".\"; in the function it gives these errors:
Parse error: unexpected $end in scandir.php at ?> last line Fatal error: Call to undefined function: scandir() in showdir.php
If I don't set $dirstr at all, it runs the scandir function and fouls up in expected ways:
Warning: opendir($dirstr): failed to open dir: Invalid argument in scandir.php
Warning: readdir(): supplied argument is not a valid Directory resource in scandir.php
Warning: closedir(): supplied argument is not a valid Directory resource in scandir.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php