Created
October 19, 2016 07:52
-
-
Save samelm/1f1be229da57aa013692a3fd02b7ccec to your computer and use it in GitHub Desktop.
Alphabet associative array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$result = []; | |
foreach ($array as $item) { | |
$letter = mb_strtoupper(mb_substr($item, 0, 1)); | |
$result[$letter][] = $item; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment