Title: Process entry provided by ftp_rawlist Marked Cool (Review this resource) Author: davidlo Posted On: 2004-12-20 Category: Home > PHP Functions
Popularity:
Description: Returns various attribute of file entry from ftp_rawlist()
Total Hits: 539 Total Votes: 0
Total Points: 0 (0 reviews)
Page Navigation: [1]
FTP Server Attributes
Introduction:
This function is designed to be used with ftp_rawlist(). After passing a line into the ftpProcessEntry, it returns an associative array containing the various attributes the FTP server provides. All this is done using the split() function.
Source Code:
<?php
function stripspaces($str)
{
while(substr($str, 0, 1)==" ")
$str=substr($str, 1);
return $str;
}
function ftpProcessEntry($line)
{
list($prop['perm'],$next)=split(" ",$line,2);
list($prop['num'],$next)=split(" ",stripspaces($next),2);
list($prop['owner'],$next)=split(" ",stripspaces($next),2);
list($prop['group'],$next)=split(" ",stripspaces($next),2);
list($prop['size'],$next)=split(" ",stripspaces($next),2);
list($prop['month'],$next)=split(" ",stripspaces($next),2);
list($prop['day'],$next)=split(" ",stripspaces($next),2);
list($prop['time'],$prop['filename'])=split(" ",stripspaces($next),2);
return $prop;
}
?>
Page Navigation: [1]
|