Link to home
Start Free TrialLog in
Avatar of prashanth ag
prashanth ag

asked on

sorting array list based on files extension in php?

Hi
Is it possible in PHP to do something like this?Here is an example.

print_r($content);
Array
(
    [2] => /userupload/one.exe
    [3] => /userupload/avatar.jpg
    [0] => /userupload/two.exe
    [1] => /userupload/three.jpg
    [4] => /userupload/three.exe
)

Open in new window



but i want array sort based on  file extension like .exe , .jpg,.pdf etc
Array
(
    [2] => /userupload/one.exe
    [4] => /userupload/three.exe
    [0] => /userupload/two.exe
    [3] => /userupload/avatar.jpg
    [1] => /userupload/three.jpg
   )

Open in new window

SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prashanth ag
prashanth ag

ASKER

thanks for  Marco Gasi and Ray Paseur