Remove the display Array[0]==>


#1

Blockquote
$d = dir(".");
$dd = array();
while (false !== ($entry = $d->read())) {
if(’.’ !== $entry && ‘…’ !== $entry) {
if( is_dir($entry)){
$dd[ ]= $entry;
}
}
}
$d->close();
print_r($dd);

The code above produces the result below.

Blockquote
Array ( [0] => dir1 [1] => dir2 )

I like to produce my target result below, dir names only.

Blockquote
dir1 dir2

and I like to use “echo” instead of “print_r” with your help.


#2

foreach

or implode


#3

Blockquote foreach or implode

Thank you, m_hutley.


#4

Take a look at PHP glob(…); because it gives similar results to dir(…); and eliminates the tests for “.” and “…”

http://php.net/manual/en/function.glob.php