Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php two array difference merge recursive

function array_merge_recursive_ex(array $array1, array $array2)
{
    $merged = $array1;

    foreach ($array2 as $key => & $value) {
        if (is_array($value) && isset($merged[$key]) && is_array($merged[$key])) {
            $merged[$key] = array_merge_recursive_ex($merged[$key], $value);
        } else if (is_numeric($key)) {
             if (!in_array($value, $merged)) {
                $merged[] = $value;
             }
        } else {
            $merged[$key] = $value;
        }
    }

    return $merged;
}
Comment

PREVIOUS NEXT
Code Example
Php :: PHP multidimensional array merge recursive 
Php :: array_diff php 
Php :: php 30days 
Php :: ignore user id on email validation laravel 
Php :: the plugin generated 14 characters of unexpected output during activation. if you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin 
Php :: laravel collection splice 
Php :: laravel 6 use username instead of id 
Php :: php undefined offset 
Php :: Logging a Massage php 
Php :: 0 
Php :: php console print 
Php :: laravel get() 
Php :: laravel env use other env variables 
Php :: polymorphism in php 
Php :: get the value without setter method laravel 
Php :: laravel eloquent difference create and insert 
Php :: php get variable name as a string 
Php :: displaying variables in blade laravel 
Php :: In PackageManifest.php line 122: Undefined index: name 
Php :: remove array values php 
Php :: php backend generator 
Php :: laravel upload image 
Php :: Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255 
Php :: laravel jobs 
Php :: send data to api php 
Php :: laravel Call to a member function validate() on array 
Php :: php laravel rount price to 99 
Php :: Deprecated: Implicit conversion from float 
Php :: php radian to cosine 
Php :: Woofood Availability checker 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =