wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



str_contains › WordPress Function

Da5.9.0
Deprecaton/a
str_contains ( $haystack, $needle )
Parametri: (2)
  • (string) $haystack The string to search in.
    Richiesto:
  • (string) $needle The substring to search for in the `$haystack`.
    Richiesto:
Ritorna:
  • (bool) True if `$needle` is in `$haystack`, otherwise false.
Definito a:
Codex:

Polyfill for `str_contains()` function added in PHP 8.0.

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


Sorgenti

function str_contains( $haystack, $needle ) {
		if ( '' === $needle ) {
			return true;
		}

		return false !== strpos( $haystack, $needle );
	}
}