I have an array of order $order. I want to sort an associative array by this array by the article field. The point is to sort also other elements in this array such as title by that order. If there are more elements in the array than in sorting array, then leave them in their place as shown in the example below:
Input data:
$data = array(
"title" => array("title 1", "title 2", "title 3", "title 4", "title 5", "title 6"),
"article" => array("01", "02", "03", "04", "05", "06")
);
$order = ["03", "01", "04", "02"];
Expected result:
$data = array(
"title" => array("title 3", "title 1", "title 4", "title 2", "title 5", "title 6"),
"article" => array("03", "01", "04", "02", "05", "06")
);