note 45309 added to function.ftp-rawlist

From: Date: Wed, 01 Sep 2004 21:06:32 +0000
Subject: note 45309 added to function.ftp-rawlist
Groups: php.notes 
Request: Send a blank email to php-notes+get-75898@lists.php.net to get a copy of this message
NO, NO, NO. The above examples are all wrong, the spaces given in array are not there "just because", its just a tabbed structure. In php we don't have structures like in c/cpp, but the following function will do the job. <?php function parse_rawlist( $array ) { for ( $i = 1; $i < count($array); $i++ ) { $current = $array[$i]; $structure[$i]['perms'] = substr($current, 0, 10); $structure[$i]['number'] = trim(substr($current, 11, 3)); $structure[$i]['owner'] = trim(substr($current, 15, 8)); $structure[$i]['group'] = trim(substr($current, 24, 8)); $structure[$i]['size'] = trim(substr($current, 33, 8)); $structure[$i]['month'] = trim(substr($current, 42, 3)); $structure[$i]['day'] = trim(substr($current, 46, 2)); $structure[$i]['time'] = substr($current, 49, 5); $structure[$i]['name'] = substr($current, 55, strlen($current) - 55); } return $structure; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.ftp-rawlist.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45309 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45309&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45309&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75898) next »