public function charAt($index)
    {
        $index = (int) $index;

        if ($index < 0 || $index >= $this->length()) {
            throw new \OutOfBoundsException();
        }

        return mb_substr($this->string, $index, 1, $this->encoding);
    }
public function charAt($index)
    {
        $index = (int) $index;

        if ($index < 0 || $index >= $this->length()) {
            throw new \OutOfBoundsException();
        }

        return mb_substr($this->string, $index, 1, $this->encoding);
    }
Return the character at the given position in the sequence.

@param int $index The character index.

@return string
@throws \OutOfBoundsException If the index is out of bounds.