Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8223169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:35:26+00:00 2026-06-07T14:35:26+00:00

I have a directory listing that I need to sort. so far natsort works

  • 0

I have a directory listing that I need to sort. so far natsort works well except when a decimal is introduced. 009 comes after 009.1 I am trying to work on getting all the special char’s out of the directory names and havent had issues with them so far. “http://10.1.1.1/manual/product/v02/secton 3/part 3.1 leveling/002.jpg” some get as long as 150 or so char’s long. Since these are long strings with occasional decimals its not easy to get them properly sorted. I dont believe . are used any where except for decimals and the file extension

Every thing I have read so far ignores decimals. 0200 is before 100 in cases like that I would hope that specials would come after # and letters but appairently not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:35:28+00:00Added an answer on June 7, 2026 at 2:35 pm

    Given that you have sorting requirements that can’t be met by any existing PHP functions, your best bet is to call usort() and write your own comparison function.

    Sample

    function cmp($a, $b)
    {
        return strcmp($a, $b); # replace with your own comparison logic
    }
    usort($array, 'cmp');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that loads a massive directory listing and just (in it's
I have a directory with 1.3 Million files that I need to move into
I have a text file containing the output of a recursive directory listing that
I have a directory with files, I need to get a listing of these
I have a script that creates a directory listing of all pdfs within a
I have a directory listing for which I want to retrieve the filenames and
I am trying to generate a hierarchical directory listing in pyGTK. Currently, I have
I have directory a that is symlinked somewhere. I want to copy its contents
I need to offer a directory listing of the root directory of my site,
I have an array that lists folders in a directory. Until now, I've been

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.