I'm only just starting out on the raod along php, so bear with me.
I've been trying to read the contents of multiple files within collection of sub-directories and testing each to see whether it has a particular value inside it. If it does, I want to create collect of links to those directories and do nothing with the directories that do not have this file in the tested file.
So, I have many directories under /gallery/ and inside each of these I have a file called variable.php, the contents of which is going to vary sometimes (hence the name ). I have some code which will find all the directories and then read the contents into an multi-dimentional array. the code is:
<?PHP
$gallist=opendir("gallery");
$folders=array();
while (($folder=readdir($gallist)) !== false)
{
if ($folder != "." and $folder != "..")
{
array_push($folders, $folder);
}
}
closedir($gallist);
sort($folders);
foreach ($folders as $folder){
$filearray[$folder] = file("gallery/$folder/variables.php");
}
?>
if I use "print_r($filearray);" to see what I have in the array, it prints (test 4 is the name of one of the directories):
Array ( [test4] => Array ( [0] => $title = "Gash $gallery Gallery"; [2] => $exif = 'includes/functions/exif.php'; [3] => $paypal = 'includes/paypal/paypal.php'; [4] => $password = TRUE; [5] => $guest = TRUE; [6] => $uname = "example"; [7] => $pass = "example"; [8] => ?> ) )
The part I am interested in is the "$guest = TRUE;" part. I want to list all the /directories/variables.php having this value.
Any help would be greatly appreciated as I am now stuck. Thank you.