Automattic\WooCommerce\Utilities

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.
$case_sensitive(true|false)
Indicates whether the comparison should be case-sensitive.
По умолчанию: true

Код StringUtil::contains() WC 6.8.0

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 );
	}
}