I’d like to list/group words by the first two letters but I can’t get my head around it. I guess I can I can do a substr() and check against while looping but I’m not sure if this is the way to do it.
Something like:
if (substr($word, 0, 2) == 'aa') {
echo $word;
}
What I’m trying to achieve:
Words get sorted first by their starting letter, e.g. A, B, C etc. On the A page you have the words sorted by the first 2 letters, e.g. aa, ab, ac etc.
An example for this is http://www.urbandictionary.com/browse.php?word=aa. They do exactly what I’m after.
Help/thoughts appreciated!
If you have a bunch of words, put them grouped together in an array.
for example: