Sets a value in an (multidimensional) array, creating the arrays recursivly.

@param array $array
@param unknown_type $keys
@param unknown_type $value
14889
public function set(array $array, $keys, $value)
    {
        $keys = $this->parseKeys($keys);

        if ($keys) {
            $key = array_shift($keys);

            // This is the last key we've shifted
            if (!$keys) {
                $array[$key] = $value;
            } else {
                // There are more keys so this should be an array
                if (!isset($array[$key]) || !is_array($array[$key])) {
                    $array[$key] = array();
                }
                $array[$key] = $this->set(
                    $array[$key], $keys, $value
                );
            }
        }

        return $array;
    }
934994
public static function set(array &$array, string $key, $value, bool $create = false): void
    {
        // Extract key/path.
        $keyLast = Str::last($key, '.');
        $key = Str::removeLast($key, '.');

        // Extract data.
        $pathArray = null;
        if ($key !== '' && $key !== null) {
            $array = &self::dataByPath($array, $key, $create);
        }
        if ($array !== null || $create) {
            $array[$keyLast] = $value;
        }
    }
420407
public static function set( array &$storage, $key, $value )
	{
		$segments = explode('.', $key);

		$key = array_pop($segments);

		// iterate through all of $segments except the last one
		foreach ($segments as $segment) {
			if (!array_key_exists($segment, $storage)) {
				$storage[$segment] = array();
			} else if (!is_array($storage[$segment])) {
				throw new \UnexpectedValueException('Non-array segment encountered');
			}

			$storage =& $storage[$segment];
		}

		$storage[$key] = $value;
	}
644029
public static function add(array $array, $key, $value): array
    {
        $target = static::get($array, $key, []);

        if (! is_array($target)) {
            $target = [$target];
        }

        $target[] = $value;
        $array = static::set($array, $key, $target);

        return $array;
    }
1054150
protected function addDefault(array &$array, $key, $value)
    {
        if (empty($array[$key]) && !empty($value)) {
            $array[$key] = $value;
            return true;
        }
        return false;
    }
429846
public function set($key, $value = null)
    {
        if( is_array($key) ) {
            $this->values($key);
        } else {
            $this->value($key, $value);
        }
        return $this;
    }
499527
public function key_search( array $array, $key, $value ) {
		foreach ( $array as $key => $a ) {
			if ( isset( $a[ $key ] ) && $a[ $key ] == $value ) {
				return $key;
			}
		}

		return false;
	}
1283996
public function setData( array $array ) {
        foreach( $array as $name=>$value ) {
            if( !isset( $this->nameHash[$name] ) ) {
                continue;
            }

            $element = $this->nameHash[$name];

            $element->setAttribute( 'value', (string)$value );
        }
    }
706900
public function set($key, $value = null)
    {
        if (is_array($key)) {
            foreach ($key as $configKey => $configValue) {
                $this->setSingleItem($configKey, $configValue);
            }
        } else {
            $this->setSingleItem($key, $value);
        }
    }
48314
public function set($key, $value = null)
    {
        $keys = is_array($key) ? $key : [$key => $value];

        foreach ($keys as $key => $value) {
            Arr::set($this->items, $key, $value);
        }
    }
712016
public static function set( & $array, $key, $value)
	{
		if(is_null($key))
		{
			return $array = $value;
		}

		if(strpos($key, ".") !== false)
		{
			for( $i = 0, $keys = explode('.', $key), $count = count($keys); $i < $count; $i++ )
			{
				$key = $keys[$i];
				if( $i + 1 == $count )
				{
					break;
				}

				// If the key doesn't exist at this depth, we will just create an empty array
				// to hold the next value, allowing us to create the arrays to hold final
				// values at the correct depth. Then we'll keep digging into the array.
				if(! isset($array[$key]) || ! is_array($array[$key]))
				{
					$array[$key] = [];
				}

				$array = & $array[$key];
			}
		}

		$array[$key] = $value;

		return $array;
	}
1178492
public static function dotSet(array $array, $key, $value)
    {
        $path = explode('.', $key);
        $total = count($path);

        $current = &$array;

        for ($ii = 0; $ii < $total; $ii++) {
            if ($ii === $total - 1) {
                $current[$path[$ii]] = $value;
            } else {
                if (!is_array($current)) {
                    throw new LackOfCoffeeException(
                        'Part of the path is not an array.'
                    );
                }

                if (!array_key_exists($path[$ii], $current)) {
                    $current[$path[$ii]] = [];
                }

                $current = &$current[$path[$ii]];
            }
        }
    }
515020
public static function hasKey(Array $array, Array $keys)
    {
        foreach ($array as $key => $value) {
            if (in_array($key, $keys)) {
                return true;
            }
        }

        return false;
    }
1265958
private function recurArrayChange($array, $keyArray, $value = null)
    {
        $key0 = $keyArray[0];
        if (count($keyArray) === 1) {
            $this->changeValue($array, $key0, $value);
        } else if (is_array($array) && isset($keyArray[1])) {
            unset($keyArray[0]);
            $keyArray = array_values($keyArray);
            if (!isset($array[$key0])) {
                $array[$key0] = [];
            }
            $array[$key0] = $this->recurArrayChange($array[$key0], $keyArray, $value);
        } else {
            $this->changeValue($array, $key0, $value);
        }
        return $array;
    }
1099728
protected function _setSession($array, $value = '') {
        $data = '$_SESSION';
        $i = 0;

        foreach ($array as $keys) {
            if ($i != count($array) - 1) {
                $exec = $data . '[\'' . $keys . '\'] = [];';
                $data .= '[\'' . $keys . '\']';
            }
            else {
                $exec = $data . '[\'' . $keys . '\'] = $value;';
                $data .= '[\'' . $keys . '\']';
            }

            eval($exec);
            $i++;
        }
    }
638072
function set($key,$value=null){
        if(is_array($key)){
            self::$Config=array_merge(self::$Config,$key);
        }else{
            self::$Config[$key]=$value;
        }
    }
173649
public function add($keys, $value = null)
    {
        if (is_array($keys)) {
            foreach ($keys as $key => $value) {
                $this->add($key, $value);
            }
        } elseif (is_null($this->get($keys))) {
            $this->set($keys, $value);
        }
    }