Set an array value using "dot notation".

@param array  $values Array you want to modify.
@param string $path   Array path.
@param mixed  $value  Value to set.

@return void
176147
public static function set(array &$values, $path, $value)
    {
        if (is_array($path)) {
            // The path has already been separated into segments
            $segments = $path;
        } else {
            $path = (string) $path;

            // Remove starting delimiters and spaces
            $path = ltrim($path, sprintf('%s ', static::PATH_DELIMITER));
            // Remove ending delimiters, spaces, and wildcards
            $path = rtrim($path, sprintf('%s %s', static::PATH_DELIMITER, static::PATH_WILDCARD));
            // Split the segments by delimiter
            $segments = explode(static::PATH_DELIMITER, $path);
        }

        while (count($segments) > 1) {
            $key = array_shift($segments);

            /** @noinspection ReferenceMismatchInspection */
            if (!array_key_exists($key, $values) || !is_array($values[$key])) {
                $values[$key] = [];
            }

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

        $values[array_shift($segments)] = $value;
    }
1003295
function setValues (array $values = array())
    {
        foreach ($this->getFields() as $field)
            if (array_key_exists($field->getName(), $values))
                $field->setValue($values[$field->getName()]);
        foreach ($this->dataFields as $dataKey => $dataVal)
            if (array_key_exists($dataKey, $values))
                $this->dataFields[$dataKey] = $values[$dataKey];
    }
1349161
public function setValues($values, array $files = array())
    {
        foreach ($this->getFields() as $name => $field) {
            $name = $field->getBaseName();
            $index = $field->getIndex();

            if ($index === null) { 
                if ($present = isset($values[$name])) {
                    $value =& $values[$name];
                }
            } else {
                if ($index) {
                    $present = true;
                    $tmp = &$values[$name];
                    foreach ($index as $part) {
                        if (isset($tmp[$part])) {
                            $tmp = &$tmp[$part];
                        } else {
                            $present = false;
                        }
                    }

                    if ($present) {
                        $value = $tmp;
                    }
                } else {
                    if ($present = isset($values[$name]) && is_array($values[$name])) {
                        $value = in_array($field->getValue(), $values[$name]);
                    }
                }
            }

            if ($field instanceof Fields\Multiple) {
                if (!$present) {
                    $value = array();
                }
                $field->setValues($value, (isset($files[$name])?$files[$name]:array()));
            } else {
                if ($present) {
                    $field->setValue($value, $files);
                } else {
                    if ($field instanceof Fields\FileField && isset($files[$name])) {
                        $field->setValue($files[$name]);
                    } else {
                        $field->setValue('');
                    }
                }
            }
        }
    }
738061
public function set($path, $value)
    {
        if (!empty($path)) {
            $at   = &$this->getValues();
            $keys = $this->explode($path);

            while (count($keys) > 0) {
                if (count($keys) === 1) {
                    if (is_array($at)) {
                        $at[array_shift($keys)] = $value;
                    } else {
                        throw new \RuntimeException("Can not set value at this path ($path) because is not array.");
                    }
                } else {
                    $key = array_shift($keys);
                    if (!isset($at[$key])) {
                        $at[$key] = [];
                    }
                    $at = &$at[$key];
                }
            }
        } else {
            $this->values = $value;
        }
    }
721662
protected function setRecursive( $path, $value, &$array )
	{
		if( substr_count( $path, "." ) )
		{
			$parts	= explode( ".", $path );
			$step	= array_shift( $parts );
			$path	= implode( ".", $parts );
			return $this->setRecursive( $path, $value, $array[$step] );
		}
		else if( !(isset( $array[$path] ) && $array[$path] == $value ) )
		{
			$array[$path] = $value;
			return true;
		}
		return false;
	}
880422
public function setValue($value)
    {
        if (is_array($value)) {
            $value = implode(', ', $value);
        }

        if (!is_null($value)) {
            $this->_value = $value;
            $this->appendChild($value);
        }
    }
107994
public function set($path, $value=null) {
		#to set multiple variables at once.
		if(is_array($path)) {
			foreach($path as $k=>$v)
				static::set($k, $v);
		}
		else
			ArrayUtils::set($_SESSION, $path, $value);
	}
626408
public function setValuesAttribute(array $values = [])
    {
        static::saved(function ($model) use ($values) {
            $savedIds = [];
            foreach ($values as $data) {
                if (empty(array_filter($data))) {
                    continue;
                }
                // Create option or enable it if exists
                $value = $this->values()->updateOrCreate([
                    'code' => $data['code'],
                ], $data);
                $savedIds[] = $value->id;
            }
            $this->values()->whereNotIn('id', $savedIds)->delete();
        });
    }
660744
public function setValues($values=array()) {
		$count=$this->count();
		if (\is_array($values) === false) {
			$values=\array_fill(0, $count, $values);
		} else {
			if (JArray::isAssociative($values) === true) {
				$values=\array_values($values);
			}
		}
		$count=\min(\sizeof($values), $count);
		
		for($i=0; $i < $count; $i++) {
			$cell=$this->content[$i];
			$cell->setValue($values[$i]);
		}
	}
339683
public function setValues(array $values)
    {
        foreach ($this->type->getAttributes()->getKeys() as $attribute_name) {
            if (array_key_exists($attribute_name, $values)) {
                $this->setValue($attribute_name, $values[$attribute_name]);
            }
        }

        return $this->isValid();
    }
1243862
private function bindValues(array $values)
    {
        $this->bindedParameters = array();
        $this->bindedTypes = array();
        $this->bindedValues = array();

        foreach ($values as $parameter => $value) {
            if (is_int($parameter)) {
                $parameter++;
            }

            $this->bindValue($parameter, $value);
        }
    }
845921
public function set($path, $value)
    {
        $parts = explode('.', $path);
        switch (count($parts)) {
            case 2:
                $this->_data[$parts[0]][$parts[1]] = $value;
                break;
            case 1:
                $this->_data[$parts[0]] = $value;
                break;
            case 0:
                throw new RuntimeException('Path was empty.');
            default:
                throw new RuntimeException('Too many parts in path.');
        }
    }
156347
public static function set(&$array, $key, $value = null)
    {
        if (is_null($key)) {
            $array = $value;
            return;
        }
        if (is_array($key)) {
            foreach ($key as $k => $v) {
                static::set($array, $k, $v);
            }
        } else {
            $keys = explode('.', $key);
            while (count($keys) > 1) {
                $key = array_shift($keys);
                if (!isset($array[$key]) or !is_array($array[$key])) {
                    $array[$key] = [];
                }
                $array =& $array[$key];
            }
            $array[array_shift($keys)] = $value;
        }
    }
1310868
public function set($key, $value, $dot_syntax = true)
    {
        if ($dot_syntax === true) {

            $paths = explode('.', $key);
            $pathCount = count($paths);
            $currentIteration = 0;
            $node =& $this->_data;
            foreach ($paths as $path) {
                if (isset($node[$path])) {
                    $node =& $node[$path];
                    $currentIteration++;
                } elseif($currentIteration < $pathCount) {
                    $node[$path] = array();
                    $node =& $node[$path];
                    $currentIteration++;
                }
            }
            
            $node = $value;
            
        } else {
            
            $this->_data[$key] = $value;
            
        }

        return $this;
    }
27560
public static function set($keys, $value = null)
    {
        if (is_array($keys)) {
            self::$variables = array_merge(self::$variables, $keys);
        } else {
            self::$variables[$keys] = $value;
        }
    }
738563
public function set($path, $value)
    {
        PropertyAccessor::setByPath($this->values, $this->path($path), $value);
    }
1025367
public function set( $path, $value = null )
    {
        if ( is_null( $value ) ) {
            return $this->delete( $path );
        }

        $path = str_replace( '/', '.', $path );
        $keys = explode( ".", $path );

        $copy = $this->_value;

        $array = &$copy;

        foreach ( $keys as $key ) {
            if ( ! isset( $array[ $key ] ) ) {
                $array[ $key ] = '';
            }

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

        $array = $value;

        $this->update( $copy );

        return $value;
    }