This question already has an answer here:
- How can I sort arrays and data in PHP? 10 answers
i am basically trying to make a leaderboard system. I need to put 2 types of data in my .yml file: the name of the player, and their score.
Here is a var dump:
array(3) {
[0]=>
array(2) {
[0]=>
string(10) "samueljh1_"
[1]=>
int(3)
}
[1]=>
array(2) {
[0]=>
string(12) "samueljh1_54"
[1]=>
int(1)
}
[2]=>
array(2) {
[0]=>
string(11) "samueljh1_1"
[1]=>
int(8)
}
So, what I want to do is order this array, so that is is in numerical order - where the integers are.
Basically, converting the var dump above, to something like this:
array(3) {
[0]=>
array(2) {
[0]=>
string(11) "samueljh1_1"
[1]=>
int(8)
}
array(2) {
[1]=>
string(10) "samueljh1_"
[1]=>
int(3)
}
[2]=>
array(2) {
[0]=>
string(12) "samueljh1_54"
[1]=>
int(1)
}
}
If this isn't possible, are there any alternate ways to store this data?
Thanks A lot, - Sam.
</div>