I have a function called plugin_loader(). The job this function does is like this. It's searching trough a folder called 'plugins' using glob(). After that it should remove the unnecessary '../../' from the elements of array that is created. So for that i did foreach loop. But for some reason when i do print_r() to see if i did it correct way its displaying only last file like this: '/assets/plugins/test_plugin1.php'. But i have two files 'helloworld.php' and 'test-plugin1.php'. Why its not removing '../../' from both files instead of one? P.S I did check if both files are detected and they are.
I tried count() to see how much elements are in array and than call while loop within foreach. But that just gave me two of same output.
function Plugin_Loader()
{
$scanned_files = glob("../../assets/plugins/*.php");
foreach ($scanned_files as $file) {
$file_loc = str_replace('../', ' ', $file);
print_r($file_loc);
}
}
$file_locas an array - Lublaut$file_loc[] = str_replace('../', ' ', $file);- AbraCadaver