How can I load multiple vars each containing a single path into an array variable?
$dir1 = "/path/1/";
$dir2 = "/path/2/";
$dir3 = array($dir1, $dir2);
$directories = array($dir3);
$count = 0;
foreach ($directories as $dir) {
$files = glob("{$dir}*.gz") ?: array();
$count += count($files);
}
When I print $dir3 I get both paths as an array but I cannot get the $dir3 var for $directories to work. I have tried looking for answers but I am unable to find similar use cases. The documentation on php.net is also unclear to me. I'm still new to PHP and programming in general.
I want to figure out how I can have multiple paths in a single var but still have foreach execute on each path in the var.
foreachon$dir3? Right now you're making it an array of arrays witharray($dir3).