Mailinglisten-Archive |
hallo heiko,
> ich bekomme die fehlermeldung
>
> Warning: Wrong datatype for second argument in call to in_array() in
> /home/heikoch/public_html/test.php on line 4
>
> und kann mir nicht erklaeren woran das liegt.
>
> <?php
> $handle=opendir ('/home/heikoch/public_html');
> $file = readdir($handle);
> if (in_array('kundec', $file ))
> print "ok";
> closedir($handle);
> ?>
>
> fuer helfende koepfe dankbar
> heikoch
Here's a quick code snippet that will load the directory data into an
array.
function GetDirArray($sPath)
{
//Load Directory Into Array
$handle=opendir($sPath);
while ($file = readdir($handle))
$retVal[count($retVal)] = $file;
//Clean up and sort
closedir($handle);
sort($retVal);
return $retVal;
}
erleuchtung? readdir gibt dir kein array zurück sondern nur den nächsten
file-namen
aus dem directory-index.
gruesse/regards
andreas krahn
--
akotec - internet-services - andreas krahn
moorstrasse 14 - 21614 buxtehude - germany
tel: 04161-722260 - fax: 04161-722259
email: akrahn_(at)_akotec.de - web: www.akotec.de
php::bar PHP Wiki - Listenarchive