How to get the first character of a string in PHP?

Hello, I need to read each character in a string. I have a scenario, where I have 10 inputs. Each input can contain 1 character but I want to save all input in one string. So when I want to show the existing data I need to ready each string by index. I think if I can read the first character of the stirng I can do the same with others.

$input_string = 'ab12476541';
$character1   = ?

You can get characters from a string like array index or you can use substr() or mb_substr() function.

If the string is single-byte encoded (binary) strings:

substr($username, 0, 1);
// or 
$username[0] ?? null;

For the multi-byte encoded strings, such as UTF-8:

mb_substr($username, 0, 1);