Php how to merge arrays according to the same key value in the same array

I am a novice. I hope the boss can help solve

.

Code:
foreach ($row as $key= > $str)

    {
        if ($key > 0)
        {
            $img = substr($str, 0);
            $img = preg_match_all("/<img[^>]*>/", $img,$pic);
            foreach ($pic[0] as $v)
            {
                $v = substr($v,strpos($v,"src")+5);
                $databaseImg = [];
                $databaseImg[$key][]= substr($v,0,strpos($v," "));
            }
        }
    }
Php
Mar.31,2021

the array above you is a containing array, which contains an array and then an array, which is equal to the second level containing no root
similar

.
[
    [x => [xxx]],
    [x => [xxx]],
    [x => [xxx]]
]

if you want to remove x as key, then the code is:

$databaseImg= [];
foreach ($row as $key => $item)
{
    foreach ($item as $k => $v)
    {
        if ($v) {
            $databaseImg[$k][]= $v[0];
        }
        //$v
        //foreach ($v as $vv) {
        //    $databaseImg[$k][]= $vv;
        //}
    }
}

array_merge
Menu