over 9 years ago
Hello Reader's! if you have an given array on with you want to sort with any selected key index as show below:-
- Array
- (
- [0] => Array
- (
- [configuration_id] => 10
- [id] => 1
- [optionNumber] => 3
- [optionActive] => 1
- [lastUpdated] => 2010-03-17 15:44:12
- )
- [1] => Array
- (
- [configuration_id] => 9
- [id] => 1
- [optionNumber] => 2
- [optionActive] => 1
- [lastUpdated] => 2010-03-17 15:44:12
- )
- [2] => Array
- (
- [configuration_id] => 8
- [id] => 1
- [optionNumber] => 1
- [optionActive] => 1
- [lastUpdated] => 2010-03-17 15:44:12
- )
- )
Array ( [0] => Array ( [configuration_id] => 10 [id] => 1 [optionNumber] => 3 [optionActive] => 1 [lastUpdated] => 2010-03-17 15:44:12 ) [1] => Array ( [configuration_id] => 9 [id] => 1 [optionNumber] => 2 [optionActive] => 1 [lastUpdated] => 2010-03-17 15:44:12 ) [2] => Array ( [configuration_id] => 8 [id] => 1 [optionNumber] => 1 [optionActive] => 1 [lastUpdated] => 2010-03-17 15:44:12 ) )
And you want your array to be like this:-
- Array
- (
- [0] => Array
- (
- [configuration_id] => 8
- [id] => 1
- [optionNumber] => 1
- [optionActive] => 1
- [lastUpdated] => 2010-03-17 15:44:12
- )
- [1] => Array
- (
- [configuration_id] => 9
- [id] => 1
- [optionNumber] => 2
- [optionActive] => 1
- [lastUpdated] => 2010-03-17 15:44:12
- )
- [2] => Array
- (
- [configuration_id] => 10
- [id] => 1
- [optionNumber] => 3
- [optionActive] => 1
- [lastUpdated] => 2010-03-17 15:44:12
- )
- )
Array ( [0] => Array ( [configuration_id] => 8 [id] => 1 [optionNumber] => 1 [optionActive] => 1 [lastUpdated] => 2010-03-17 15:44:12 ) [1] => Array ( [configuration_id] => 9 [id] => 1 [optionNumber] => 2 [optionActive] => 1 [lastUpdated] => 2010-03-17 15:44:12 ) [2] => Array ( [configuration_id] => 10 [id] => 1 [optionNumber] => 3 [optionActive] => 1 [lastUpdated] => 2010-03-17 15:44:12 ) )
Now you have to use the code as written below:-
0 Comment(s)