Automattic\WooCommerce\StoreApi\Utilities
ArrayUtils::string_contains_array
Check if a string contains any of the items in an array.
Method of the class: ArrayUtils{}
No Hooks.
Returns
true|false
. true if the string contains any of the items in the array, false otherwise.
Usage
$result = ArrayUtils::string_contains_array( $needle, $haystack );
- $needle(string) (required)
- The string to check.
- $haystack(array) (required)
- The array of items to check for.
ArrayUtils::string_contains_array() ArrayUtils::string contains array code WC 9.8.5
public static function string_contains_array( $needle, $haystack ) { foreach ( $haystack as $item ) { if ( false !== strpos( $needle, $item ) ) { return true; } } return false; }