fork download
  1. <?php
  2.  
  3. $arr = array(
  4. 'name' => array(
  5. 0 => 'img/test240.jpg',
  6. 1 => 'img/cs1.jpg',
  7. 2 => 'img/cs2.jpg',
  8. 3 => 'img/cs3.jpg',
  9. ),
  10. 'link' => array(
  11. 0 => 'http://google.com',
  12. 1 => 'http://google.com',
  13. 2 => 'http://f...content-available-to-author-only...k.com',
  14. 3 => 'http://o...content-available-to-author-only...t.com',
  15. ),
  16. 'order' => array(
  17. 0 => 4,
  18. 1 => 1,
  19. 2 => 2,
  20. 3 => 3,
  21. ),
  22. );
  23.  
  24. function mysort($a) {
  25. asort($a);
  26. return $a;
  27. }
  28.  
  29. $arr = array_map('mysort', $arr);
  30. print_r($arr);
  31.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [name] => Array
        (
            [1] => img/cs1.jpg
            [2] => img/cs2.jpg
            [3] => img/cs3.jpg
            [0] => img/test240.jpg
        )

    [link] => Array
        (
            [2] => http://f...content-available-to-author-only...k.com
            [1] => http://google.com
            [0] => http://google.com
            [3] => http://o...content-available-to-author-only...t.com
        )

    [order] => Array
        (
            [1] => 1
            [2] => 2
            [3] => 3
            [0] => 4
        )

)