StringUtil::contains()public staticWC 1.0

Checks if one string is contained into another at any position.

Метод класса: StringUtil{}

Хуков нет.


true|false. True if $contained is contained inside $string, false otherwise.


$result = StringUtil::contains( $string, $contained, $case_sensitive ): bool;
$string(строка) (обязательный)
The string we want to check.
$contained(строка) (обязательный)
The string we're looking for inside $string.
Indicates whether the comparison should be case-sensitive.
По умолчанию: true

Код StringUtil::contains() WC 9.0.2

public static function contains( string $string, string $contained, bool $case_sensitive = true ): bool {
	if ( $case_sensitive ) {
		return false !== strpos( $string, $contained );
	} else {
		return false !== stripos( $string, $contained );