public function recursiveScandir(string $dir)
    {
        $contents = array();

        foreach (scandir($dir) as $file) {
            if ($file == '.' || $file == '..') {
                continue;
            }

            $path = $dir.DIRECTORY_SEPARATOR.$file;

            if (is_dir($path)) {
                $contents = array_merge($contents, $this->recursiveScandir($path));
            } else {
                $contents[] = $path;
            }
        }
        return ($contents);
    }
public function recursiveScandir(string $dir)
    {
        $contents = array();

        foreach (scandir($dir) as $file) {
            if ($file == '.' || $file == '..') {
                continue;
            }

            $path = $dir.DIRECTORY_SEPARATOR.$file;

            if (is_dir($path)) {
                $contents = array_merge($contents, $this->recursiveScandir($path));
            } else {
                $contents[] = $path;
            }
        }
        return ($contents);
    }
public function recursiveScandir ( string $ dir ) { $ contents = array ( ) ; foreach ( scandir ( $ dir ) as $ file ) { if ( $ file == '.' || $ file == '..' ) { continue ; } $ path = $ dir . DIRECTORY_SEPARATOR . $ file ; if ( is_dir ( $ path ) ) { $ contents = array_merge ( $ contents , $ this -> recursiveScandir ( $ path ) ) ; } else { $ contents [ ] = $ path ; } } return ( $ contents ) ; }
Scan directory and subdirectory
@param string $dir Path
@return array
Scan directory and subdirectory