Berserker bArrays Class was made to simulate a package for the native array functions of PHP.
The berserker project offer you 2 approaches, using static classes or instantiated methods. This is not interchangeable. You select the approach you want when you instantiate berserker class, check Composer version at https://blastcoding.com/en/php-berserker/
static class:
bArrays::
instantiated method:
bArrays->
Berserker bArrays Class methods
ok, let’s see what methods offer bArrays for now:
uppercaseKeys
– uses PHP array_change_key_case
Description / DescripciónuppercaseKeys($array):array
lowercaseKeys
– uses PHP array_change_key_case
Description / DescripciónlowercaseKeys($array):array
chunk
– uses PHP array_chunk
Description / Descripciónchunk(array $array, int $length, bool $preserve_keys = false): array
column
– uses PHP array_column
Description / Descripcióncolumn(array $array, int|string|null $column_key, int|string|null $index_key = null): array
valueExists
– uses PHP in_array
Description / DescripciónvalueExists(mixed $needle, array $haystack, bool $strict = false): bool
keyExists
– uses PHP array_key_exists
Description / DescripciónkeyExists(string|int|float|bool|null $key, array $array): bool
valueOccurrences
– uses PHP array_count_values
Description / DescripciónvaluesOccurrences(array $array): array
ascendingSort
– uses PHP sort
Description / DescripciónascendingSort(array &$array, int $flags = SORT_REGULAR): true
descendingSort
– uses PHP rsort
Description / DescripcióndescendingSort(array &$array, int $flags = SORT_REGULAR): true
ascendingKeySort
– uses PHP ksort
Description / DescripciónascendingKeySort(array &$array, int $flags = SORT_REGULAR): true
descendingKeySort
– uses PHP krsort
Description / DescripcióndescendingKeySort(array &$array, int $flags = SORT_REGULAR): true
keys
– uses PHP array_keys
Description / Descripciónkeys(array $array, mixed $filter_value = null, bool $strict = false): array
firstKey
– uses PHP array_key_first
Description / DescripciónfirstKey(array $array): int|string|null
lastKey
– uses PHP array_key_last
Description / DescripciónlastKey(array $array): int|string|null