PHPackages                             mitsuru793/array-helper-function - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mitsuru793/array-helper-function

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mitsuru793/array-helper-function
================================

This adds functions about array. If you feel like there few php built-in functions about array, this will be useful.

v0.1.0(7y ago)03.6kMITPHP

Since Mar 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/mitsuru793/php-array-helper-function)[ Packagist](https://packagist.org/packages/mitsuru793/array-helper-function)[ Docs](https://github.com/mitsuru793/php-array-helper-function)[ RSS](/packages/mitsuru793-array-helper-function/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (6)Versions (4)Used By (0)

array-helper-function
=====================

[](#array-helper-function)

This adds functions about array. If you feel like there few php built-in functions about array, this will be useful.

Installation
============

[](#installation)

if you're using Composer to manage dependencies, you can include the following in your composer.json file:

```
"require": {
    "mitsuru793/array-helper-function
}
```

Then, after running composer update or php composer.phar update, you can load the class using Composer's autoloading:

```
require 'vendor/autoload.php';
```

Functions
=========

[](#functions)

condtion
--------

[](#condtion)

- [is\_empty\_array](#is_empty_arrayvalue-bool)
- [is\_full\_array](#is_full_arrayvalue-bool)
- [is\_numeric\_array](#is_numeric_arrayvalue-bool)
- [is\_numeric\_array\_recursive](#is_numeric_array_recursivearray-bool)
- [array\_every](#array_everyarray-array-callable-test--null-bool)
- [array\_any](#array_anyarray-array-callable-test--null-bool)

each
----

[](#each)

- [array\_keys\_recursive](#array_keys_recursivearray-array-array)
- [array\_diff\_key\_recursive](#array_diff_key_recursivearray-main-array-other-array)
- [array\_filter\_recursive](#array_filter_recursivearray-callable-test--null-array)

access
------

[](#access)

- [array\_get](#array_getarray-array-path-string-separator--)
- [array\_set](#array_setarray-array-path-value-string-separator---void)
- [array\_unset](#array_unsetarray-array-path-string-separator---void)
- [array\_pick](#array_pickarray-array-array-values-array)

### Function detail

[](#function-detail)

#### is\_empty\_array($value): bool

[](#is_empty_arrayvalue-bool)

Finds whether a variable is a empty array.

return true when value is

- `[]`

returns false when value is

- not array(ex: `0`, `1`, `true`, `null` ...)
- `[1, 2]`
- `[null]`
- `[[], []]`

```
is_empty_array([]) // true
```

#### is\_full\_array($value): bool

[](#is_full_arrayvalue-bool)

Finds whether a variable is a full array, so it's not empty array.

return true when value is

- `[1, 2]`
- `[null]`
- `[[], []]`

returns false when value is

- `[]`
- not array(ex: `0`, `1`, `true`, `null` ...)

```
is_full_array([1]) // true
```

#### is\_numeric\_array($value): bool

[](#is_numeric_arrayvalue-bool)

Finds whether all keys of variable are integer. This does not find deeply if element of `$value` is array.

return true when value is

- `[]`
- `[null]`
- `[['k1' => 'v1'], 'v2]`

returns false when value is

- not array(ex: `0`, `1`, `true`, `null` ...)
- `['k1' => 'v1', 'v2]`

```
is_numeric_array([1]) // true
```

#### is\_numeric\_array\_recursive($array): bool

[](#is_numeric_array_recursivearray-bool)

Finds whether all keys of variable are integer deeply. This is like [is\_numeric\_array](#is_numeric_array)

return true when value is

- `[]`
- `[null]`

returns false when value is

- not array(ex: `0`, `1`, `true`, `null` ...)
- `['k1' => 'v1', 'v2]`
- `[['k1' => 'v1'], 'v2]`

```
is_numeric_array_recursive([1]) // true
```

#### array\_every(array $array, callable $test = null): bool

[](#array_everyarray-array-callable-test--null-bool)

Verify that all elements of a `$array` pass a given truth `$test`.

```
array_every([1, 2, 3], function ($value, $key) {
    retrun $value > 2;
});
// false
```

If the `$array` is empty, every will return true.

```
array_every([]) // true
```

If the `$test` is null, verify all them are truly.

```
array_every([1, 2, 3]);
// true
```

#### array\_any(array $array, callable $test = null): bool

[](#array_anyarray-array-callable-test--null-bool)

Verify that a element of a `$array` pass a given truth `$test`.

```
array_every([1, 2, 3], function ($value, $key) {
    retrun $value > 2;
});
// true
```

If the `$array` is empty, every will return false.

```
array_every([]) // false
```

If the `$test` is null, verify one is truly.

```
array_every([1, 2, 3]);
// true
```

#### array\_keys\_recursive(array $array): array

[](#array_keys_recursivearray-array-array)

This is like [array\_keys](http://php.net/manual/en/function.array-keys.php), but recursively. Return combinations of all keys.

```
$array = [
    'Japan' => [
        'Tokyo' => [
            'user1' => 'Mike',
            'user2' => 'Jane',
            'Hiro',
            'Hanako',
        ],
        'Kyoto' => [],
    ],
    'Take',
];

array_keys_recursive($array);
// [
//     ['Japan', 'Tokyo', 'user1'],
//     ['Japan', 'Tokyo', 'user2'],
//     ['Japan', 'Tokyo', 0],
//     ['Japan', 'Tokyo', 1],
//     ['Japan', 'Kyoto'],
//     0,
// ]
```

#### array\_diff\_key\_recursive(array $main, array $other): array

[](#array_diff_key_recursivearray-main-array-other-array)

This is like [array\_diff\_key](http://php.net/manual/en/function.array-diff-key.php), but recursively.

```
$main = [
    'user' => [
        'name' => 'Mike',
        'age' => 20,
    ],
];
$other = [
    'id' => 2,
    'user' => [
        'name' => 'Jane',
        'from' => 'America',
        'sex' => 'woman',
    ],
];

array_diff_key_recursive($main, $other));
// [
//     'user' => [
//         'age' => 20
//     ]
// ]

array_diff_key_recursive($other, $main));
// [
//     'id' => 2,
//     'user' => [
//         'from' => 'America',
//         'sex' => 'woman',
//     ],
// ]

```

#### array\_filter\_recursive($array, callable $test = null): array

[](#array_filter_recursivearray-callable-test--null-array)

This is like [array\_filter](http://php.net/manual/en/function.array-filter.php), but recursively. The closure `$test` is passed `$key` by default.

```
$array = [
    'Japan' => [
        'Hiroki-Man',
        'Kaede-Woman',
        'Tokyo' => [
            'Taro-Man',
            'Hanako-Woman',
        ],
    ],
    'America' => [
        'Jane-Woman',
        'Mike-Man',
    ],
];

array_filter_recursive($array, function ($v, $k) {
    if (!is_string($v)) {
        return true;
    }
    return preg_match('/Man/', $v);
});
// [
//     'Japan' => [
//         'Hiroki-Man',
//         'Tokyo' => [
//             'Taro-Man',
//         ],
//     ],
//     'America' => [
//         1 => 'Mike-Man',
//     ],
// ]
```

#### array\_get(array $array, $path, string $separator = '.')

[](#array_getarray-array-path-string-separator--)

Retrieves a value from a nested array. Notation of `$path` is dot or array. If `$path` is string, you can modify its separator from dot as 3rd argument.

```
$array = [
    'user' => [
        'name' => 'mike',
    ],
];

array_get($array, ['user', 'name']);
array_get($array, 'user.name');
array_get($array, 'user_name', '_');
// mike

array_get($array, 'invalid');
// null
```

#### array\_set(array &amp;$array, $path, $value, string $separator = '.'): void

[](#array_setarray-array-path-value-string-separator---void)

Set a `$value` within a nested array. Notation of `$path` is dot or array. If `$path` is string, you can modify its separator from dot as 3rd argument.

```
$array = [];

array_set($array, ['user', 'name'], 'Mike');
array_set($array, 'user.name', 'Mike');
array_set($array, 'user_name', 'Mike', '_');

$array;
// [
//     'user' => [
//         'name' => 'Mike'
//     ]
// ]
```

#### array\_unset(array &amp;$array, $path, string $separator = '.'): void

[](#array_unsetarray-array-path-string-separator---void)

Set a `$value` within a nested array. Notation of `$path` is dot or array. If `$path` is string, you can modify its separator from dot as 3rd argument.

```
$array = [
    'user' => [
        'name' => 'Mike',
    ],
];

array_unset($array, ['user', 'name']);
array_unset($array, 'user.name');
array_unset($array, 'user_name', '_');

$array;
// [
//     'user' => []
// ]
```

#### array\_pick(array &amp;$array, array $values): array

[](#array_pickarray-array-array-values-array)

Find whether `$values` match elements of `$array` strictly, and takes matched values from `$array`. Has side effect and modify `$array`.

```
$array = ['a', null, true, 'b'];

$picked;
// [0 => 'a', 2 => true]

$array;
// [1 => null, 3 => 'b']

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

4

Last Release

2670d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a57812f339f77f920c07f196883c9336e4be2ec8ac187c51a8c74424a417a2c7?d=identicon)[mitsuru793](/maintainers/mitsuru793)

---

Top Contributors

[![mitsuru793](https://avatars.githubusercontent.com/u/8012508?v=4)](https://github.com/mitsuru793 "mitsuru793 (30 commits)")

---

Tags

helperarrayfunctionutil

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mitsuru793-array-helper-function/health.svg)

```
[![Health](https://phpackages.com/badges/mitsuru793-array-helper-function/health.svg)](https://phpackages.com/packages/mitsuru793-array-helper-function)
```

###  Alternatives

[laravelista/ekko

Framework agnostic PHP package for marking navigation items active.

274700.4k4](/packages/laravelista-ekko)[bocharsky-bw/arrayzy

A native PHP arrays easy manipulation library in OOP way.

38427.7k](/packages/bocharsky-bw-arrayzy)[spatie/array-functions

Some handy array helpers

24866.2k2](/packages/spatie-array-functions)[minwork/array

Pack of advanced array functions specifically tailored for: associative (assoc) array, multidimensional array, array of objects and handling nested array elements

66268.2k5](/packages/minwork-array)[clausnz/php-helpers

A Collection of useful php helper functions.

3810.4k](/packages/clausnz-php-helpers)[bayfrontmedia/php-array-helpers

Helper class to provide useful array functions.

1414.6k26](/packages/bayfrontmedia-php-array-helpers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
