You can easily group them, even if they are not sorted:
$groups=array(); foreach ($names as $name) { $groups[$name[0]][] = $name[1]; }
You do not even need to save the first file to group them:
$names = array( 'Alanis Morissette', 'Alesha Dixon', 'Alexandra Burke', 'Britney Spears', 'Bryan Adams', ... ); $groups=array(); foreach ($names as $name) { $groups[$name[0]][] = $name; }
outis source share