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 8930575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:55:17+00:00 2026-06-15T08:55:17+00:00

How Can I sort following files numerically, I mean 1 2 3 4… I

  • 0

How Can I sort following files numerically, I mean 1 2 3 4…

I have used sort(), asort(), sort(, sort_numeric) functions but it is not working

4 Walka Duchowa Madry Umysl Zamkniety Na Sily Demoniczne.mp3
3 Walka Duchowa Swieci Na Terytorium wroga.mp3
21 Walka Duch Oszczep Modlitwy _08_12_12.mp3
20 Walka Duchowa Oszczep.mp3
5 Walka Duchowa Chrzescijanstwo Ciezko Zbrojna Artyleria.mp3
6 Walka Duchowa W Koncu Bracia Moi.mp3
9 Walka Duchowa Pas Prawdy.mp3
8 Walka Duchowa Diabelskie Zasadzki.mp3
7 Walka Duchowa.mp3
2 Walka Duchowa Rozbrojony Wrog.mp3
19 Walka Duchowa Oszczep_cz_C.mp3
13 Walka_duchowa Helm Zbawiebia 06_17_12.mp3
12 Walka_duchowa Tarcza Wiary__06_10_12.mp3
11 Walka Duchowa Obuwie Pokoju.mp3
10 Walka Duchowa Pancerz Sprawiedliosci.mp3
13b Walka Duchowa Helm Zbawienia 06_24_12.mp3
15 Walka Duchowa Miecz Ducha 07-01-12.mp3
18 Walka Duch Oszczep Modlitwy _07_22_12.mp3
17 Walka_Duch Oszczep Modlitwy 07_15_12.mp3
16 Walka Duch 16 Miecz Ducha 07_08_12.mp3
1 Walka Duchowa Niweczenie mocy diabla.mp3

  • 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-15T08:55:18+00:00Added an answer on June 15, 2026 at 8:55 am

    natsort() will give the order that you are looking for, even with files like 13 and 13b.

    The question is a little devious, since you don’t really want to sort solely numerically.


    <?php
    
    $files = explode("\n", trim('
    7 Walka Duchowa.mp3
    2 Walka Duchowa Rozbrojony Wrog.mp3
    13 Walka_duchowa Helm Zbawiebia 06_17_12.mp3
    12 Walka_duchowa Tarcza Wiary__06_10_12.mp3
    13b Walka Duchowa Helm Zbawienia 06_24_12.mp3
    15 Walka Duchowa Miecz Ducha 07-01-12.mp3
    '));
    
    natsort($files);
    echo implode("\n", $files);
    

    Gives the following order:

    2 Walka Duchowa Rozbrojony Wrog.mp3
    7 Walka Duchowa.mp3
    12 Walka_duchowa Tarcza Wiary__06_10_12.mp3
    13 Walka_duchowa Helm Zbawiebia 06_17_12.mp3
    13b Walka Duchowa Helm Zbawienia 06_24_12.mp3
    15 Walka Duchowa Miecz Ducha 07-01-12.mp3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can we sort the following dict with respect to the capital alphabet letters
How can you sort the following word by the given rule? Example data is
Can any one help me how to sort rows by relevance for the following
I can sort by key or value, but I need it sorted by value,
I have been trying to create a ListView which I can sort using drag
I have the following code which outputs the contents of text files held in
I have the following code written to make my lazy second CPU core working.
Say I have two log files ( input.log and output.log ) with the following
I'm not sure if this sort of thing is very common, but I keep
Let's say I have the following form with 2 files: <!-- the field below

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.