I have 2 array. first:
$comment = Array (
[1] => 1
[ 2] => 1
[ 3] => 8
[ 5] => 3
[ 6] => 2
[ 7] => 4
)
And I have a second array:
$item = Array (
[0] => Array ( [id] => 1 [title] => Neque porro quisquam est qui dolorem )
[1] => Array ( [id] => 2 [title] => Sed a est quis sem pellentesque luctus. )
[2] => Array ( [id] => 3 [title] => There is no one who loves pain itself )
[3] => Array ( [id] => 5 [title] => There is no one who loves pain itself )
[4] => Array ( [id] => 6 [title] => Sed a est quis sem pellentesque luctus. )
[5] => Array ( [id] => 7 [title] => Neque porro quisquam est qui dolorem )
)
In the array "comment" key it is id in the array "item". I want to sort array "item" for the value of array "comment".
For Example:
[2] => Array ( [id] => 3 [title] => There is no one who loves pain itself ) // value in $comment 8
[5] => Array ( [id] => 7 [title] => Neque porro quisquam est qui dolorem ) // value in $comment 4
[3] => Array ( [id] => 5 [title] => There is no one who loves pain itself ) // value in $comment 3
...
I tried to sort using array_multisort but I could not do it. Help solve this problem.
$itemusing$commentto get your given result.