I have an array like:

```
$unsorted = Array(
"0" =>"3470U11",
"1" =>"3470E11",
"2" =>"3470S13",
"3" =>"3470G11",
"4" =>"3470S12",
"5" =>"3470S11",
"6" =>"3470E12",
"7" =>"3470U12",
"8" =>"3470G13",
"9" =>"3470G12",
"10" =>"3470E13",
"11" =>"3470U13"
);

```

And a priority array like this:

```
$sortBy = array('G','D','S','U','E','T','A','L');

```

I need to sort the array by the `substr($value,-3,1)` in the order listed in `$sortBy` so the result becomes like:

```
$sorted = Array(
"0" => "3470G11",
"1" => "3470G12",
"2" => "3470G13",
"3" => "3470S11",
"4" => "3470S12",
"5" => "3470S13",
"6" => "3470U11",
"7" => "3470U12",
"8" => "3470U13",
"9" => "3470E11",
"10" =>"3470E12",
"11" =>"3470E13"
);

```