What I'm looking for is to make an array that contains only the names of folders (directories) of a given route.
I tried scandir ():
$scan = scandir(realpath(__dir__));
for ($i = 0; $i < count($scan); $i++) {
if (is_file(dirname(__file__) . '\' . $scan[$i])) {
//Si es un archivo Eliminalo en su posicion $i
array_splice($scan, $i, 1);
}
}
But there is still an .sql file in the array that should not be there:
[0] => . [1] => .. [3] => controladores [7] => modelos [8] => vistas [9] => zonaedu.sql
//en el último elemento --> ^^^^^^^^^^^
Why is this?