Skip to content

Instantly share code, notes, and snippets.

@flesch
Created August 18, 2012 15:00
Show Gist options
  • Select an option

  • Save flesch/3387294 to your computer and use it in GitHub Desktop.

Select an option

Save flesch/3387294 to your computer and use it in GitHub Desktop.

Revisions

  1. flesch revised this gist Nov 22, 2012. 1 changed file with 14 additions and 14 deletions.
    28 changes: 14 additions & 14 deletions list_dir.php
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,17 @@
    <?php

    function list_dir($resource) {
    $files = array();
    $scan = glob(rtrim($resource, '/') . '/*');
    if (is_file($resource)) {
    array_push($files, $resource);
    }
    if (is_dir($resource)) {
    foreach ($scan as $path) {
    $files = array_merge($files, call_user_func(__FUNCTION__, $path));
    }
    }
    return $files;
    }
    function list_dir($resource) {
    $files = array();
    $scan = glob(rtrim($resource, '/') . '/*');
    if (is_file($resource)) {
    array_push($files, $resource);
    }
    if (is_dir($resource)) {
    foreach ($scan as $path) {
    $files = array_merge($files, call_user_func(__FUNCTION__, $path));
    }
    }
    return $files;
    }

    ?>
    ?>
  2. flesch created this gist Jan 3, 2011.
    17 changes: 17 additions & 0 deletions list_dir.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    <?php

    function list_dir($resource) {
    $files = array();
    $scan = glob(rtrim($resource, '/') . '/*');
    if (is_file($resource)) {
    array_push($files, $resource);
    }
    if (is_dir($resource)) {
    foreach ($scan as $path) {
    $files = array_merge($files, call_user_func(__FUNCTION__, $path));
    }
    }
    return $files;
    }

    ?>