fork download
  1. <?php
  2.  
  3. $sortOrder = array("bms", "dr", "fds", "pcm", "fr");
  4. $arr = array
  5. (
  6. 'bms' => array
  7. (
  8. 0 => '123456_bms_for__on__(10-06-2015_18-57).pdf'
  9. ),
  10.  
  11. 'fr' => array
  12. (
  13. '123456_fr_on_09-21-2015_(09-22-2015_11-46).pdf'
  14. ),
  15.  
  16. 'pcm' => array
  17. (
  18. '123456_pcm_for_vignesh_on__(10-12-2015_12-30).pdf'
  19. ),
  20.  
  21. 'fds' => array
  22. (
  23. '123456_fds_ext_for__on__(08-25-2015_10-23).pdf'
  24. ),
  25.  
  26. 'dr' => array
  27. (
  28. '123456_dr_for__on___(10-23-2015_13-06).pdf'
  29. )
  30.  
  31. );
  32.  
  33. uksort($arr, function($a, $b) use ($sortOrder) {
  34. return array_search($a, $sortOrder) - array_search($b, $sortOrder);
  35. });
  36. print_r($arr);
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Array
(
    [bms] => Array
        (
            [0] => 123456_bms_for__on__(10-06-2015_18-57).pdf
        )

    [dr] => Array
        (
            [0] => 123456_dr_for__on___(10-23-2015_13-06).pdf
        )

    [fds] => Array
        (
            [0] => 123456_fds_ext_for__on__(08-25-2015_10-23).pdf
        )

    [pcm] => Array
        (
            [0] => 123456_pcm_for_vignesh_on__(10-12-2015_12-30).pdf
        )

    [fr] => Array
        (
            [0] => 123456_fr_on_09-21-2015_(09-22-2015_11-46).pdf
        )

)