am using php glob() function to find files with specific extensions, and if both file and script are in same folder it works. However I have to access files in another folder as well, and for this will have to use a variable to hold the path and then glob(). Anyone can help me with this?
working code:
<?php
foreach(glob("*.txt") as $filename){
echo $filename;
//unlink ($filename);
//break;
}
?>
My new code:
$var to hold path to other files, e.g. $var1 = '/path/to/folder'
glob will have to know which path $var1 is pointing to so that can read all text files
Any other alternative to glob() is also welcomed