Jump to content

sorting without arrays


o5iri5

Recommended Posts

Hi, how would one go about to sort the following, since there are no arrays ?

 

thanks

 

oops - posted in the wrong place, sorry...can someone move this please ?

 

<?
  $path = "/tmp";
  $html = array();
  $html = directoryToHtml2($path, true); 
  function directoryToHtml2($directory, $recursive) {
    $html = "";
    if ($handle = opendir($directory)) {
      while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
  if (is_dir($directory. "/" . $file)) {
    if($recursive) {
      $html.= "<li><a href=\"\" onclick=\"return false;\">$file</a>\n";
      $html.= directoryToHtml2($directory."/".$file, $recursive);
      $html.= "</li>\n";
    }
  } else {
      $html.= "<li><a href=\"\" onclick=\"loadWin('".$directory."/".$file."');return false;\">$file</a></li>\n";
  }
}
      }
      closedir($handle);
    }
    if ($html != "") {
      $html = "<ul>$html</ul>\n";                                                                                                                                 
    }
    return $html;
  }
?>

Link to comment
https://forums.phpfreaks.com/topic/202292-sorting-without-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.