Change the key of a two-dimensional array element
@return NULL
@param $var array
@param $old string
@param $new string
555175
function changekey(array &$var,$old,$new) {
		$keys=array_keys($var);
		$vals=array_values($var);
		$keys[array_search($old,$keys)]=$new;
		$var=array_combine($keys,$vals);
	}
972891
public function mergeAttributes( $old, $new ) {
		$attributes = [
			'methods' => $this->mergeMethodsAttribute(
				(array) Arr::get( $old, 'methods', [] ),
				(array) Arr::get( $new, 'methods', [] )
			),

			'condition' => $this->mergeConditionAttribute(
				Arr::get( $old, 'condition', null ),
				Arr::get( $new, 'condition', null )
			),

			'middleware' => $this->mergeMiddlewareAttribute(
				(array) Arr::get( $old, 'middleware', [] ),
				(array) Arr::get( $new, 'middleware', [] )
			),

			'namespace' => $this->mergeNamespaceAttribute(
				Arr::get( $old, 'namespace', '' ),
				Arr::get( $new, 'namespace', '' )
			),

			'handler' => $this->mergeHandlerAttribute(
				Arr::get( $old, 'handler', '' ),
				Arr::get( $new, 'handler', '' )
			),

			'query' => $this->mergeQueryAttribute(
				Arr::get( $old, 'query', null ),
				Arr::get( $new, 'query', null )
			),
		];

		return $attributes;
	}
818351
protected function updateFavicon( $new, $old )
    {
        $this->removeFile( $old );
        $new = $this->addFile( $new, 'settings/favicon.%2$s' );
        $this->setSetting( 'faviconType', $this->getMime( $new ) );
        return $new;
    }
93268
public static function mergeGroup($new, $old)
    {
        $new['namespace'] = static::formatUsesPrefix($new, $old);

        $new['prefix'] = static::formatGroupPrefix($new, $old);

        if (isset($new['domain'])) {
            unset($old['domain']);
        }

        $new['where'] = array_merge(
            isset($old['where']) ? $old['where'] : array(),
            isset($new['where']) ? $new['where'] : array()
        );

        if (isset($old['as'])) {
            $new['as'] = $old['as'] .(isset($new['as']) ? $new['as'] : '');
        }

        return array_merge_recursive(
            Arr::except($old, array('namespace', 'prefix', 'where', 'as')), $new
        );
    }
138877
public function setProperty($key, $value)
    {
        $oldValue = null;
        if (isset($this->properties[$key])) {
            $oldValue = $this->properties[$key];
        }
        $this->properties[$key] = $value;

        return $oldValue;
    }
94402
public function move(string $old, string $new){
    if (
      !empty($old) &&
      !empty($new) &&
      ($old = $this->checkFilePath($old)) &&
      ftp_rename($this->cn, $old, $new)
    ){
      return true;
    }
    return false;
  }
782859
protected function getNewFeedItems(array $new, array $old)
    {
        $map = array();
        $getKey = function($item) {
            return $item->getPermalink();
        };
        $logger = $this->getLogger();
        foreach ($new as $item) {
            $key = $getKey($item);
            $logger->debug('New: ' . $key);
            $map[$key] = $item;
        }
        foreach ($old as $item) {
            $key = $getKey($item);
            $logger->debug('Old: ' . $key);
            unset($map[$key]);
        }
        $logger->debug('Diff: ' . implode(' ', array_keys($map)));
        return array_values($map);
    }
652425
public function mergeConditionAttribute( $old, $new ) {
		try {
			$condition = $this->condition_factory->merge( $old, $new );
		} catch ( ConfigurationException $e ) {
			throw new ConfigurationException( 'Route condition is not a valid route string or condition.' );
		}

		return $condition;
	}
747323
public static function mergeGroup($new, $old)
	{
		$new['namespace'] = static::formatUsesPrefix($new, $old);

		$new['prefix'] = static::formatGroupPrefix($new, $old);

		if (isset($new['domain'])) unset($old['domain']);

		$new['where'] = array_merge(array_get($old, 'where', []), array_get($new, 'where', []));

		return array_merge_recursive(array_except($old, array('namespace', 'prefix', 'where')), $new);
	}
1217052
public static function mergeGroup($new, $old)
	{
		$new['namespace'] = static::formatUsesPrefix($new, $old);

		$new['prefix'] = static::formatGroupPrefix($new, $old);

		if (isset($new['domain'])) unset($old['domain']);

		return array_merge_recursive(array_except($old, array('namespace', 'prefix')), $new);
	}
1244634
protected function formatPrefix($new, $old)
    {
        if (isset($new['prefix'])) {
            return trim(Arr::get($old, 'prefix'), '/').'/'.trim($new['prefix'], '/');
        }

        return Arr::get($old, 'prefix', '');
    }
712400
public function _apply($oldValue, $obj, $key)
    {
        if (!$oldValue)
        {
            return $this->objects;
        }
        if (!is_array($oldValue))
        {
            $oldValue = (array) $oldValue;
        }
        foreach ($this->objects as $object)
        {
            if ($object instanceof AVObject && $object->getObjectId())
            {
                if (!$this->isAVObjectInArray($object, $oldValue))
                {
                    $oldValue[] = $object;
                }
            } else if (is_object($object))
            {
                if (!in_array($object, $oldValue, true))
                {
                    $oldValue[] = $object;
                }
            } else
            {
                if (!in_array($object, $oldValue, true))
                {
                    $oldValue[] = $object;
                }
            }
        }

        return $oldValue;
    }
944569
public function update(string $key, $oldValue, $newValue, AbstractElement $element)
	{
		if (!isset($this->index[$key])) {
			throw new MissingAttrIndexException("Attribute index \"$key\" is not defined.");
		}

		$id = $element->getId();

		if (isset($this->index[$key][$oldValue][$id])) {
			unset($this->index[$key][$oldValue][$id]);
		} else {
			throw new MissingElementException("Old value of \"$id\" is not indexed.");
		}

		$this->index[$key][$newValue][$id] = $element;
	}
518375
public function update($key, $newvars, $oldvars)
    {
        $ts = microtime(true);

        if ($newvars !== $oldvars || $ts - $this->changed > $this->lifetime / 3) {
            $data   = serialize(array('changed' => time(), 'ip' => $this->ip, 'vars' => $newvars));
            $result = $this->memcache->set($key, $data, MEMCACHE_COMPRESSED, $this->lifetime + 60);

            if ($this->debug) {
                $this->debug('set', $key, $data, $result);
            }

            return $result;
        }

        return true;
    }
452086
protected function mergeGroup(array $new, array $old)
    {
        $new['namespace'] = $this->formatNamespace($new, $old);

        $new['prefix'] = $this->formatPrefix($new, $old);

        foreach (['middleware', 'providers', 'scopes', 'before', 'after'] as $option) {
            $new[$option] = $this->formatArrayBasedOption($option, $new);
        }

        if (isset($new['domain'])) {
            unset($old['domain']);
        }

        if (isset($new['conditionalRequest'])) {
            unset($old['conditionalRequest']);
        }

        if (isset($new['uses'])) {
            $new['uses'] = $this->formatUses($new, $old);
        }

        $new['where'] = array_merge(Arr::get($old, 'where', []), Arr::get($new, 'where', []));

        if (isset($old['as'])) {
            $new['as'] = trim($old['as'].'.'.Arr::get($new, 'as', ''), '.');
        }

        return array_merge_recursive(array_except($old, ['namespace', 'prefix', 'where', 'as']), $new);
    }
380112
function replace($old, $new, $limit = null) {
		$old = self::toNativeString ( $old );
		$new = self::toNativeString ( $new );
		$oldLength = strlen ( $old );
		$newLength = strlen ( $new );
		$string = $this->string;
		$offset = 0;
		for ($i = 0; $limit === null || $i < $limit; $i ++) {
			$position = strpos ( $string, $old, $offset );
			if ($position === false) {
				break;
			}
			$string = substr_replace ( $string, $new, $position, $oldLength );
			$offset += $position + $newLength;
		}
		return new self ( $string );
	}
1258377
public function replace($old, $new)
    {
        $this->str = $this->str->replace((string)$old, (string)$new);

        return $this;
    }