hey,

De bedoeling is enkel mappen te echo'en. dit werkt goed behalve dat een *.js bestand ook wordt getoond

op php.net zag ik bij substr dit staan als uitleg

string substr ( string $string , int $start [, int $length ] )

If start is non-negative, the returned string will start at the start 'th position in string , counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth. 

If start is negative, the returned string will start at the start 'th character from the end of string . 

If string is less than or equal to start characters long, FALSE will be returned. 


als ik dit goed begrijp is -4 voor *.html bestanden en -3 voor *.php, *.swf,.. enz bestanden, klopt dit ?

hoe en waar kan ik dan een -2 toevoegen zodat het *.js bestand niet meer wordt ge-echo'd

mijn code

<?php
$set_dir = $_SERVER['DOCUMENT_ROOT']."/extrahuurwoningen";
if($handle = opendir("$set_dir"))
{
while (false !== ($dir = readdir($handle)))
{
$extentie = substr($dir, -4, -3);
if(($dir != ".") AND ($dir != "..") AND ($extentie != "."))//. is de huidige map, en .. is dat er een hogere map is.
{
echo "$dir <br>";
}
}
}
?>

mvg
<?php
$dirs = glob('/*', GLOB_ONLYDIR);
?>

Reageren