Skip to content

Instantly share code, notes, and snippets.

@samelm
Created October 19, 2016 07:52
Show Gist options
  • Save samelm/1f1be229da57aa013692a3fd02b7ccec to your computer and use it in GitHub Desktop.
Save samelm/1f1be229da57aa013692a3fd02b7ccec to your computer and use it in GitHub Desktop.

Revisions

  1. samelm created this gist Oct 19, 2016.
    7 changes: 7 additions & 0 deletions alpha.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    <?php
    $result = [];
    foreach ($array as $item) {
    $letter = mb_strtoupper(mb_substr($item, 0, 1));
    $result[$letter][] = $item;
    }
    ?>