o5iri5 Posted May 19, 2010 Share Posted May 19, 2010 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 More sharing options...
kenrbnsn Posted May 19, 2010 Share Posted May 19, 2010 What are you trying to sort? Ken Link to comment https://forums.phpfreaks.com/topic/202292-sorting-without-arrays/#findComment-1060844 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.