title: how to get all image using php readdir method?
body: <p>am using readdir to get all the image from the folder like</p>
  
  <pre><code>function get_user_image($valid_user){
      $rootdir = "../../../user/".$valid_user;
      $dir = opendir("../../../user/".$valid_user);
      $image = array();
      scan_image($image,$rootdir);
      print_r($image);
  }
  function scan_image($arr,$root){
      $dir = opendir($root);
      while (false!=($file=readdir($dir))){
          if($file!='.'&amp;&amp;$file!='..'){
              $isfile = strripos($file, ".");
              if($isfile)
              {
                  $filetype = substr($file,$isfile+1);
                  if($filetype=="jpg")
                  {
                      //echo $file."&lt;/br&gt;";
                      array_push($arr, $file);
  
                      echo sizeof($arr)."&lt;/br&gt;";
  
                  }
              }
               else
              {
                   $curpath = $root."/".$file;
                   scan_image($arr,$curpath);
              }
          }
  
       }
   }
  </code></pre>
  
  <p>but the print_r($image) is empty,however,the echo sizeof($arr) is right, any idea why?</p>