for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ThinKit\Helpers;
class Arr
{
public static function arrayMergeRecursiveDistinct(array &$array1, array &$array2): array
$merged = $array1;
foreach ($array2 as $key => &$value) {
if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
$merged[$key] = static::arrayMergeRecursiveDistinct($merged[$key], $value);
} else {
$merged[$key] = $value;
}
return $merged;