Jump to content

Glob Question


The Little Guy

Recommended Posts

An example without bad recursion!

[code]<?

$base = array ( './www/' );

$keep = array ();

while ( ! empty ( $base ) )
{
$next = array_pop ( $base );

foreach ( glob ( $next . '*' ) AS $directory )
{
if ( is_dir ( $directory ) )
{
$base[] = $directory . '/';
$keep[] = $directory . '/';
}
}
}

print_r ( $keep );

?>[/code]


printf
Link to comment
https://forums.phpfreaks.com/topic/32116-glob-question/#findComment-149113
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.