Stringy\Stringy::offsetExists PHP Méthode

offsetExists() public méthode

Returns whether or not a character exists at an index. Offsets may be negative to count from the last character in the string. Implements part of the ArrayAccess interface.
public offsetExists ( mixed $offset ) : boolean
$offset mixed The index to check
Résultat boolean Whether or not the index exists
    public function offsetExists($offset)
    {
        $length = $this->length();
        $offset = (int) $offset;
        if ($offset >= 0) {
            return $length > $offset;
        }
        return $length >= abs($offset);
    }