![black laptop computer turned on on table](/sites/default/files/styles/large/public/2023-02/james-harrison-vpOeXr5wmR4-unsplash.jpg?itok=vdr8xyQa)
For the 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);
For the 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);
Add new comment