I have one array ($sort)
that looks like:
[1]=>16701
[2]=>16861
[3]=>16706
And an array ($images)
, which looks like:
[0]=>
array(4) {
["href"]=> string(35) "mystring"
["url"]=> string(67) "mystring2"
["didascalia"]=> string(29) "mystring3"
["id"]=> 16861
}
[1]=>
array(4) {
["href"]=> string(35) "mystring"
["url"]=> string(70) "mystring2"
["didascalia"]=> string(37) "mystring3"
["id"]=> 16706
}
[2]=>
array(4) {
["href"]=> string(35) "mystring"
["url"]=> string(66) "mystring2"
["didascalia"]=> string(24) "mystring3"
["id"]=> 16701
}
I need to sort $images
, based on value "id"
, using $sort
.
So my result should be
[0]=>
array(4) {
["href"]=> string(35) "mystring"
["url"]=> string(66) "mystring2"
["didascalia"]=> string(24) "mystring3"
["id"]=> 16701
}
[1]=>
array(4) {
["href"]=> string(35) "mystring"
["url"]=> string(67) "mystring2"
["didascalia"]=> string(29) "mystring3"
["id"]=> 16861
}
[2]=>
array(4) {
["href"]=> string(35) "mystring"
["url"]=> string(70) "mystring2"
["didascalia"]=> string(37) "mystring3"
["id"]=> 16706
}
How can I do it?
I tried using multisort, array_map but without success.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…