- print_r: documentation ( source)
- mb_strtoupper: documentation ( source)
<?php
$phrases = array("Aaa", "abb", "acc", "bbb", "bb2");
$groups = array();
foreach($phrases as $phrase) {
$firstLetter = mb_strtoupper($phrase{0});
$groups[$firstLetter][] = $phrase;
}
print_r($groups);