<?php

namespace App\Repositories\Core;

class Arrays
{
    public static function changeKeyName($array, $newkey, $oldkey)
    {
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $array[$key] = self::changeKeyName($value, $newkey, $oldkey);
            } else {
                $array[$newkey] = $array[$oldkey];
            }
        }
        unset($array[$oldkey]);
        return $array;
    }
}
