str_contains()WP 5.9.0

Performs a case-sensitive check indicating if needle is contained in haystack.

No Hooks.

Return

true|false. True if $needle is in $haystack, otherwise false.

Usage

str_contains( $haystack, $needle );
$haystack(string) (required)
The string to search in.
$needle(string) (required)
The substring to search for in the haystack.

Changelog

Since 5.9.0 Introduced.

Code of str_contains() WP 6.0

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