Documentation

Utils
in package

Utility helpers.

Table of Contents

Methods

expandKeys()  : mixed
Expand keys to dot notation so `skipKeys` works as expected and can skip multidimensional arrays. This functionality also keeps the reference!
in_array_column()  : bool|mixed
Check if an array of objects or arrays has a property with a given value.
isJson()  : array<string|int, mixed>|false
Check if passed string is JSON.
semverToInt()  : mixed
Convert a semver version-string to an integer. This does not support alpha, beta, next or other release channels - but prereleases.

Methods

expandKeys()

Expand keys to dot notation so `skipKeys` works as expected and can skip multidimensional arrays. This functionality also keeps the reference!

public static expandKeys(mixed &$arr[, string $skipKeys = [] ]) : mixed
Parameters
$arr : mixed
$skipKeys : string = []
Tags
see
https://stackoverflow.com/a/40217420/5506547

in_array_column()

Check if an array of objects or arrays has a property with a given value.

public static in_array_column(array<string|int, mixed> $arr, string $key, string $value[, bool $returnObj = false ]) : bool|mixed
Parameters
$arr : array<string|int, mixed>
$key : string
$value : string
$returnObj : bool = false
Return values
bool|mixed

isJson()

Check if passed string is JSON.

public static isJson(string $string[, mixed $default = false ]) : array<string|int, mixed>|false
Parameters
$string : string
$default : mixed = false
Tags
see
https://stackoverflow.com/a/6041773/5506547
Return values
array<string|int, mixed>|false

semverToInt()

Convert a semver version-string to an integer. This does not support alpha, beta, next or other release channels - but prereleases.

public static semverToInt(string $semver) : mixed

Examle: 2.18.0-10597 -> 0002 0018 0000 0010597

Parameters
$semver : string
Tags
see
https://regex101.com/r/GcX7VV/2

        
On this page

Search results