Tough to explain so here's an example:
$strings = array(
array("languageCode" => "ES", "string" => "hola"),
array("languageCode" => "EN", "string" => "hello"),
array("languageCode" => "IT", "string" => "ciao"),
array("languageCode" => "CHS", "string" => "您好"),
);
I would like to sort strings by languageCode
value, by defining the order:
function magicStringOrder(array $strings, array $languageCodeOrder){
// ....
return $strings;
}
$strings = magicStringOrder($strings, array('EN', 'IT') );
$strings = array(
array("languageCode" => "EN", "string" => "hello"),
array("languageCode" => "IT", "string" => "ciao"),
array("languageCode" => "ES", "string" => "hola"),
array("languageCode" => "CHS", "string" => "您好"),
);
There is magicStringOrder
?
I now know that it is a simple problem to solve with a few loops. I would need a very fast function (it is called many times, with large array)