PHPackages                             sunaoka/hash-php - 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. sunaoka/hash-php

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

sunaoka/hash-php
================

Merge one or more associative arrays recursively. This function does not append numeric indexes like array\_merge\_recursive() function.

v1.0.0(2y ago)1423↓50%MITPHPPHP &gt;=5.5CI passing

Since Aug 24Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/sunaoka/hash-php)[ Packagist](https://packagist.org/packages/sunaoka/hash-php)[ RSS](/packages/sunaoka-hash-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Hash::merge() for PHP
=====================

[](#hashmerge-for-php)

[![Latest](https://camo.githubusercontent.com/bf95e18d7615390708b2a80feb8abb7bf958425885fcfd78688a2ec1a103b6f2/68747470733a2f2f706f7365722e707567782e6f72672f73756e616f6b612f686173682d7068702f76)](https://packagist.org/packages/sunaoka/hash-php)[![License](https://camo.githubusercontent.com/e76e63fe3f0d40b98244900d686058d76a4da6b76f025d1d29b5cfa0317a44db/68747470733a2f2f706f7365722e707567782e6f72672f73756e616f6b612f686173682d7068702f6c6963656e7365)](https://packagist.org/packages/sunaoka/hash-php)[![PHP](https://camo.githubusercontent.com/e756007ed135dcedea37608d45d8a212100cf017e8888b891b9884f1d06d4e26/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f73756e616f6b612f686173682d706870)](composer.json)[![Test](https://github.com/sunaoka/hash-php/actions/workflows/test.yml/badge.svg)](https://github.com/sunaoka/hash-php/actions/workflows/test.yml)[![codecov](https://camo.githubusercontent.com/81fac523e4470179d0cdcb66757820d5197cf48d1b80f7af58a52640dadd6035/68747470733a2f2f636f6465636f762e696f2f67682f73756e616f6b612f686173682d7068702f67726170682f62616467652e737667)](https://codecov.io/gh/sunaoka/hash-php)

---

Merge one or more associative arrays recursively

This function does not append numeric indexes like [array\_merge\_recursive()](https://php.net/array-merge-recursive) function.

For example
-----------

[](#for-example)

### array\_merge\_recursive()

[](#array_merge_recursive)

```
$result = array_merge_recursive(['key' => 'old value'], ['key' => 'new value']);
print_r($result);
// => Array
// (
//     [key] => Array
//         (
//             [0] => old value
//             [1] => new value
//         )
//
// )
```

### but, Hash::merge()

[](#but-hashmerge)

```
$result = Hash::merge(['key' => 'old value'], ['key' => 'new value']);
print_r($result);
// => Array
// (
//     [key] => new value
// )
```

Installation
------------

[](#installation)

```
composer require sunaoka/hash-php
```

Usage
-----

[](#usage)

```
use Sunaoka\Hash\Hash;

Hash::merge(['key' => 'old value'], ['key' => 'new value']);

// => Array
// (
//     [key] => new value
// )
```

```
use Sunaoka\Hash\Hash;

$array1 = ['a' => '1', 'b' => ['c' => '1', 'd' => '1', 'g' => ['h' => '1']]];
$array2 = ['a' => '2', 'b' => ['c' => '2', 'e' => '2', 'g' => ['h' => '2']]];
$array3 = ['a' => '3', 'b' => ['c' => '3', 'f' => '3', 'g' => ['h' => '3']]];

Hash::merge($array1, $array2, $array3);

// => Array
// (
//     [a] => 3
//     [b] => Array
//         (
//             [c] => 3
//             [d] => 1
//             [g] => Array
//                 (
//                     [h] => 3
//                 )
//
//             [e] => 2
//             [f] => 3
//         )
//
// )
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance51

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

999d ago

### Community

Maintainers

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

---

Top Contributors

[![sunaoka](https://avatars.githubusercontent.com/u/105845?v=4)](https://github.com/sunaoka "sunaoka (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sunaoka-hash-php/health.svg)

```
[![Health](https://phpackages.com/badges/sunaoka-hash-php/health.svg)](https://phpackages.com/packages/sunaoka-hash-php)
```

PHPackages © 2026

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