I'm making a simple FTP client in PHP, and I'd like to use an equivalent of is_dir
.
Basically I have:
$ftp_connection = ftp_connect($ftp_server,$ftp_port,$timeout) or die("Could not connect to $ftp_server");
/* other things here */
$documents = ftp_rawlist($ftp_connection,ftp_pwd($ftp_connection));
foreach($documents as $current_document){
/* if is_dir($current_document) do something */
echo $current_document;
echo "<br>";
}
Obviously it does not work, and I tried to resolve in this way:
if($current_document[0]=='d') /* do something */;
And it works fine, but I'm not sure it's a correct way, thus, I'd like to use ftp_nlist
rather than ftp_rawlist
.