Jump to content

sorting an array


bm4499

Recommended Posts

Hi does anyone know how to sort the array below (files)

echo "<br /><br /><b>Favorites</b><br />";

$d = dir("/mnt/disk/v1/mfiles/downloads/music/favorites/");

while (false !== ($entry = $d->read()))

{

if($entry!='.' && $entry!='..')

{

if(is_dir($entry))

{

echo 'true';

$subdirs = get_leaf_dirs($entry);

if ($subdirs)

$array = asort(array_merge($array, $subdirs));

else

$array[] = $entry;

}

echo '<a href="/scripts/download.php?actie=favorites/'.$entry.'" title="Click here to download this song" target="_blank">'.left($entry,(strlen($entry)-4)).'</a><br />';

}

}

$d->close();

 

Link to comment
Share on other sites

  • 2 weeks later...

Ok, you need to learn how to communicate a little better.

 

You saw?  You tried "some"?  What are some?  Some of the sorting functions?  Why did you try them, and how did you do it?  How did you determine they didn't work?  What does "work" even mean to you?  Did your computer catch fire?  Did they come out in the wrong order?  Did your monitor go blank? 

 

Maybe you can help me with my car while I'm here.  It was making the noise, so I tried things, and they didn't work.

Link to comment
Share on other sites

sorry but u need to read better. I wrote I have tried some of those examples of php.net, especially for you asort, sort and so on. Stop answering questions with other questions. Just give a solution and don't waste our time any longer.

 

The example of an unsorted array is given completely. Go read again.

Link to comment
Share on other sites

Guest
This topic is now 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.