Replace deprecated character access syntax

This `$string{0}` character access syntax was around for a while in PHP but always scared me.
The `{0}` syntax is deprecated in PHP 6. It was never a good idea to use it. It's so confusing to use curly brackets for array access.

I prefer `substr` over `[0]` because it's more "type safe" in a way. `substr` is guaranteed to return a string, even if the input is an integer, for example (which is relevant in this case). `[0]` does have a different meaning depending on the type, e.g. returns `NULL` on integers.