function contains()

in src/str/introspect.php [58:76]


function contains(
  string $haystack,
  string $needle,
  int $offset = 0,
)[]: bool {
  if ($needle === '') {
    if ($offset === 0) {
      return true;
    }
    $length = length($haystack);
    if ($offset > $length || $offset < -$length) {
      throw new \InvalidArgumentException(
        format('Offset %d out of bounds for length %d', $offset, $length)
      );
    }
    return true;
  }
  return search($haystack, $needle, $offset) !== null;
}