Automattic\WooCommerce\StoreApi\Utilities
ArrayUtils::string_contains_array()
Check if a string contains any of the items in an array.
Метод класса: ArrayUtils{}
Хуков нет.
Возвращает
true|false
. true if the string contains any of the items in the array, false otherwise.
Использование
$result = ArrayUtils::string_contains_array( $needle, $haystack );
- $needle(строка) (обязательный)
- The string to check.
- $haystack(массив) (обязательный)
- The array of items to check for.
Код ArrayUtils::string_contains_array() ArrayUtils::string contains array WC 9.7.1
public static function string_contains_array( $needle, $haystack ) { foreach ( $haystack as $item ) { if ( false !== strpos( $needle, $item ) ) { return true; } } return false; }