I have a comma separated string/array:
$input = "facebook,steam,tumblr,email,instagram,twitter,twitch,youtube,pinterest,amazon,disqus";$input = explode(",", $input);
that I want to be ordered based on another array:
$order = "email,facebook,instagram,twitter,twitch,youtube,steam,pinterest,tumblr,amazon,disqus";$order = explode(",", $order);
$input
will always contain a value that is in $order
and I want it to be sorted based on the order that it comes in $order
. This is a bit tricky because $input
will only contain a subset of values from $order
.
For example, an input of twitter,twitch,email,facebook
would return email,facebook,twitter,twitch
I have already found This Solution but it does not apply because I am not dealing with keys in my array.