Assuming that I have following situation:
I have an array like this:
$array = array(1 => "text1",2 => "text2", 3 => "Text3" , 4 => "Text4");
After some functions I receive a string which contains these values:
$string = "2,1,4,3"; // this values are dynamic
What I want to achieve is to sort that array ($array) in the string's order; so the result should be:
<--- some function --- >
$result = array(2 => "text2",1=> "text1",4=>"Text4",3=>"Text3"));