src/StringBuilder.php
public function lastIndexOf($string, $offset = null)
    {
        $string = static::convertString($string, $this->encoding);
        $offset = $offset !== null ? (int) $offset : null;

        if ($offset !== null && ($offset < 0 || $offset >= $this->length())) {
            throw new \OutOfBoundsException();
        }

        return mb_strrpos($this->string, $string, $offset, $this->encoding);
    }
public function lastIndexOf($string, $offset = null)
    {
        $string = static::convertString($string, $this->encoding);
        $offset = $offset !== null ? (int) $offset : null;

        if ($offset !== null && ($offset < 0 || $offset >= $this->length())) {
            throw new \OutOfBoundsException();
        }

        return mb_strrpos($this->string, $string, $offset, $this->encoding);
    }
Return the last occurrence of a string in the sequence.

@param string   $string The sequence to search for.
@param int|null $offset The offset index to search from.

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