str_contains

函数
str_contains ( $haystack, $needle )
参数
  • (string) $haystack The string to search in.
    Required:
  • (string) $needle The substring to search for in the haystack.
    Required:
返回值
  • (bool) True if `$needle` is in `$haystack`, otherwise false.
定义位置
相关方法
wp_ssl_constantsms_file_constantsthe_contentuser_canthe_content_rss
引入
5.9.0
弃用
-

str_contains: 这是一个PHP函数,用于检查一个字符串是否包含另一个字符串。它需要两个参数,$haystack 和 $needle。如果$needle在$haystack中找到,则返回真,否则返回假。

PHP 8.0中添加的`str_contains()’函数的填充。

执行区分大小写的检查,表明针是否包含在haystack中。

function str_contains( $haystack, $needle ) {
		return ( '' === $needle || false !== strpos( $haystack, $needle ) );
	}
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-05 17:32:57

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: