Home:ALL Converter>how to sort array based on value os child array

how to sort array based on value os child array

Ask Time:2015-04-25T16:04:26         Author:mydeve

Json Formatter

Below is my array , i want to sort it based on [attributes]->[0]->[value] how can i do it please guide me. i tried using sort but how to make it work for value of child array. Pls guide me its new for me.

[549246] => Array
        (
            [info] => Array
                (
                    [price] => $281.00
                    [qty] => 10
                    [prod_id] => 549246
                )

            [attributes] => Array
                (
                    [0] => Array
                        (
                            [code] => sizes
                            [label] => Size
                            [value] => 25mg
                            [attribute_id] => 191
                            [option_id] => 26
                        )

                )

        )

    [549245] => Array
        (
            [info] => Array
                (
                    [price] => $75.00
                    [qty] => 10
                    [prod_id] => 549245
                )

            [attributes] => Array
                (
                    [0] => Array
                        (
                            [code] => sizes
                            [label] => Size
                            [value] => 5mg
                            [attribute_id] => 191
                            [option_id] => 24
                        )

                )

        )

Author:mydeve,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/29862648/how-to-sort-array-based-on-value-os-child-array
yy