Eléphanteau du PHP |
36 Messages
04 juil. 2007, 17:10
En faites voilà ma fonction:
function read_dir($path) {
$out = array();
if (!is_dir($path) || !$handle = @dir($path))
{
trigger_error('\''.$path.'\' doesn\'t exists or is not a valid directory', E_USER_ERROR);
}
else
{
while ($entry = $handle->read())
{
if ($entry !== "." && $entry !== "..")
{
$path_to_entry = $path.'/'.$entry;
if ($entry !== '.' && $entry !== '..' && @is_dir($path_to_entry))
{
$out[$entry] = read_dir($path_to_entry, $full_list);
}
else
{
$out[$entry] = $path_to_entry;
}
}
}
}
return $out;
}
et j'affiche mon tableau complet avec
print_r(read_dir($path));
et moi je voudrai affiche une valeur particuliere pour pouvoir l'utiliser pour un lien ou un truc comme ça donc est ce que je dois utiliser
echo read_dir($path)[0];
ou
echo $out[0];