Lines Matching defs:needle
91 public static function str_contains(string $haystack, string $needle): bool
93 return '' === $needle || false !== strpos($haystack, $needle);
96 public static function str_starts_with(string $haystack, string $needle): bool
98 return 0 === strncmp($haystack, $needle, \strlen($needle));
101 public static function str_ends_with(string $haystack, string $needle): bool
103 if ('' === $needle || $needle === $haystack) {
111 $needleLength = \strlen($needle);
113 return $needleLength <= \strlen($haystack) && 0 === substr_compare($haystack, $needle, -$needleLength);