I have an array as follows:
Array(
[27] => \'Sarah Green\',
[29] => \'Adam Brown\',
[68] => \'Fred Able\'
);
I\'d like
I'm not sure if there's a straight-forward way of sorting your example array by surnames.
You could add names to the array in a different manner. i.e. "Fred Able" would become "Able, Fred". That would allow you to use PHP's inbuilt array-sorting functions.
Failing that, you might have to go through each array element and explode by whitespace, using the last piece of the returned array as your surname. A bit messy, but I'm sure there are tonnes of examples and functions out there.