PHP Polyfills (analogues PHP functions replacement) (tag)

array_is_list()

Checks if an array is a list.

is_iterable()

Checks whether the contents of the variable match the pseudo-type iterable, that is, whether it is an array or an object implementing Traversable.

str_contains()

Checks if the specified string (substring) is in another string. Case sensitive.

str_ends_with()

Checks if the string ends with the specified substring. Case sensitive.

str_starts_with()

Checks if the string starts with the specified substring. Case sensitive.

wp_basename()

Gets the last component from the specified path or URL, retrieving everything after the last /.

wp_filesize()

Gets the size of the specified file.

wp_generate_uuid4()

Generates an identifier - a random unique string consisting of letters and numbers. Creates UUID (Universally unique identifier) version 4.

wp_json_encode()

Encode a variable into JSON, with some sanity checks. Checks strings and translates them to UTF-8.

wp_mkdir_p()

Recursively creates a directory (folder) at the specified path. Does nothing if the folder already exists. Grants parent permissions to new folders.

wp_parse_str()

Parses the query string, for example, foo=1&foo2=2 and creates an array of data from it.

wp_rand()

Generates a random number between the specified min and max.

wp_sprintf()

Variant of the PHP function sprintf() from WordPress. Supports %l (list) in the passed format.