Welcome Guest, Not a member yet? Register   Sign In
sorting filenames from directory
#1

[eluser]tfncruz[/eluser]
Hi!

I'm getting the filenames from a directory to an array and I want to sort the filenames inside that array. The problem is, if you use sort($filenames) this will result in a sort like this: "img 1.jpg", "img 10.jpg". "img 11.jpg",... etc. He puts page 2, 3, ..., 9 in the end.

I'm not sure why he's doing this but it seems that it's somehow related to the fact that this numbers are not integers but, instead, they're strings... They're not organized by their value but by their char code... I don't know. What I know is that I should have finished this project last weak and I'm still &$%#?# with it :S

Anyone have a function that sorts this array properly?

help? Please?

Thanks!

@edit
btw, renaming the files isn't an option...


Messages In This Thread
sorting filenames from directory - by El Forum - 09-04-2008, 11:18 AM
sorting filenames from directory - by El Forum - 09-04-2008, 11:32 AM
sorting filenames from directory - by El Forum - 09-04-2008, 11:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB