ArrayUtils
in package
ArrayUtils class used for custom functions to operate on arrays
Table of Contents
- natural_language_join() : string
- Join a string with a natural language conjunction at the end.
- string_contains_array() : bool
- Check if a string contains any of the items in an array.
Methods
natural_language_join()
Join a string with a natural language conjunction at the end.
public
static natural_language_join(array<string|int, mixed> $array[, bool $enclose_items_with_quotes = false ]) : string
Parameters
- $array : array<string|int, mixed>
-
The array to join together with the natural language conjunction.
- $enclose_items_with_quotes : bool = false
-
Whether each item in the array should be enclosed within quotation marks.
Return values
string — a string containing a list of items and a natural language conjuction.string_contains_array()
Check if a string contains any of the items in an array.
public
static string_contains_array(string $needle, array<string|int, mixed> $haystack) : bool
Parameters
- $needle : string
-
The string to check.
- $haystack : array<string|int, mixed>
-
The array of items to check for.