What potential pitfalls should be considered when using ftp_rawlist to retrieve directory information, particularly in relation to system-dependent outputs?

When using ftp_rawlist to retrieve directory information, one potential pitfall to consider is that the output format can vary depending on the system the FTP server is running on. This can lead to inconsistencies in parsing the directory listing data. To address this issue, it is important to account for the different output formats by implementing a robust parsing mechanism that can handle various formats.

// Connect to FTP server
$ftp_server = 'ftp.example.com';
$ftp_user = 'username';
$ftp_pass = 'password';
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user, $ftp_pass);

// Get raw directory listing
$rawlist = ftp_rawlist($conn_id, '/path/to/directory');

// Parse raw directory listing based on system-dependent outputs
foreach ($rawlist as $line) {
    // Implement parsing logic based on the specific format of the raw directory listing
}

// Close FTP connection
ftp_close($conn_id);