2014-11-01 138 views
0

這裏是我的數組:多維2D數組排序

Array 
(
    [0] => Array 
     (
      [product_option_id] => 1072 
      [option_id] => 5 
      [name] => Sizes 
      [type] => select 
      [option_value] => Array 
       (
        [0] => Array 
         (
          [product_option_value_id] => 8282 
          [option_value_id] => 57 
          [name] => 10 
          [price] => 
          [price_prefix] => + 
         ) 

        [1] => Array 
         (
          [product_option_value_id] => 8283 
          [option_value_id] => 58 
          [name] => 11 
          [price] => 
          [price_prefix] => + 
         ) 

        [2] => Array 
         (
          [product_option_value_id] => 8284 
          [option_value_id] => 59 
          [name] => 12 
          [price] => 
          [price_prefix] => + 
         ) 

        [3] => Array 
         (
          [product_option_value_id] => 8285 
          [option_value_id] => 60 
          [name] => 13 
          [price] => 
          [price_prefix] => + 
         ) 

        [4] => Array 
         (
          [product_option_value_id] => 8279 
          [option_value_id] => 61 
          [name] => 7 
          [price] => 
          [price_prefix] => + 
         ) 

        [5] => Array 
         (
          [product_option_value_id] => 8280 
          [option_value_id] => 62 
          [name] => 8 
          [price] => 
          [price_prefix] => + 
         ) 

        [6] => Array 
         (
          [product_option_value_id] => 8281 
          [option_value_id] => 63 
          [name] => 9 
          [price] => 
          [price_prefix] => + 
         ) 

       ) 

      [required] => 1 
     ) 

) 

是有可能[請將option_value] [$ i] [名]排序?所以這個輸出應該是:

Array 
(
    [0] => Array 
     (
      [product_option_id] => 1072 
      [option_id] => 5 
      [name] => Sizes 
      [type] => select 
      [option_value] => Array 
       (


        [0] => Array 
         (
          [product_option_value_id] => 8279 
          [option_value_id] => 61 
          [name] => 7 
          [price] => 
          [price_prefix] => + 
         ) 

        [1] => Array 
         (
          [product_option_value_id] => 8280 
          [option_value_id] => 62 
          [name] => 8 
          [price] => 
          [price_prefix] => + 
         ) 

        [2] => Array 
         (
          [product_option_value_id] => 8281 
          [option_value_id] => 63 
          [name] => 9 
          [price] => 
          [price_prefix] => + 
         ) 
        [3] => Array 
         (
          [product_option_value_id] => 8282 
          [option_value_id] => 57 
          [name] => 10 
          [price] => 
          [price_prefix] => + 
         ) 

        [4] => Array 
         (
          [product_option_value_id] => 8283 
          [option_value_id] => 58 
          [name] => 11 
          [price] => 
          [price_prefix] => + 
         ) 

        [5] => Array 
         (
          [product_option_value_id] => 8284 
          [option_value_id] => 59 
          [name] => 12 
          [price] => 
          [price_prefix] => + 
         ) 

        [6] => Array 
         (
          [product_option_value_id] => 8285 
          [option_value_id] => 60 
          [name] => 13 
          [price] => 
          [price_prefix] => + 
         ) 

       ) 

      [required] => 1 
     ) 

) 

我失去了很多時間在這一點,如果有人可以,請幫我一下吧(tryed在array_multisort但沒有結果)

+0

請告訴我們您到目前爲止嘗試了些什麼。 – mihai 2014-11-01 22:37:15

回答