Speed up development with full-stack environments for every branch.

Learn More

How to iterate a Phar archive files [PHP]

36 Runs 244 Views 92 Copies
Saved

Saved

gtsolutions 373

gtsolutions
published 4 years ago

<?php

/*
 * PHP Phar - How to iterate a Phar archive files
 */

$p = new Phar('my.phar');
// Phar extends SPL's RecursiveIterator class
foreach (new RecursiveIteratorIterator($p) as $file) {
        // $file is a PharFileInfo class, and inherits from SplFileInfo
        echo $file->getFileName() . "<br />";
    }
?>

Please login/signup to get access to the terminal.

Your session has timed out.

Dismiss (the page may not function properly).