wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



str_starts_with › WordPress Function

Od5.9.0
Przestarzałyn/a
str_starts_with ( $haystack, $needle )
Parametry: (2)
  • (string) $haystack The string to search in.
    Wymagane: Tak
  • (string) $needle The substring to search for in the `$haystack`.
    Wymagane: Tak
Powrót:
  • (bool) True if `$haystack` starts with `$needle`, otherwise false.
Zdefiniowane na:
Codex:

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

Performs a case-sensitive check indicating if the haystack begins with needle.


Źródło

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

		return 0 === strpos( $haystack, $needle );
	}
}