RarArchive
PHP Manual

RarArchive::list

rar_list

(PECL rar >= 2.0.0)

RarArchive::list -- rar_listGet entries full list from the RAR archive.

Description

Object oriented style (method):

public array RarArchive::list ( void )

Procedural style:

array rar_list ( RarArchive $rarfile )

Get entries list (files and directories) from the RAR archive.

Parameters

rarfile

A RarArchive object, opened with rar_open().

Return Values

rar_list() returns array of RarEntry objects or FALSE on failure.

Examples

Example #1 Object oriented style

<?php
$rar_arch 
RarArchive::open('solid.rar');
if (
$rar_arch === FALSE)
    die(
"Could not open RAR archive.");

$rar_entries $rar_arch->list();
if (
$rar_entries === FALSE)
    die(
"Could retrieve entries.");

echo 
"Found " count($rar_entries) . " entries.\n";

foreach (
$rar_entries as $e) {
    echo 
$e;
    echo 
"\n";
}
$rar_arch->close();
?>

The above example will output something similar to:

Found 2 entries.
RarEntry for file "tese.txt" (23b93a7a)
RarEntry for file "unrardll.txt" (2ed64b6e)

Example #2 Procedural style

<?php
$rar_arch 
rar_open('solid.rar');
if (
$rar_arch === FALSE)
    die(
"Could not open RAR archive.");

$rar_entries rar_list($rar_arch);
if (
$rar_entries === FALSE)
    die(
"Could retrieve entries.");

echo 
"Found " count($rar_entries) . " entries.\n";

foreach (
$rar_entries as $e) {
    echo 
$e;
    echo 
"\n";
}
rar_close($rar_arch);
?>


RarArchive
PHP Manual