code: 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);
      }
docs: 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.