code: public static function set(array $arr, $k, $v)
  	{
  		$nested = !is_array($k) ? explode('.',$k) : $k;
  		$count = count($nested);
  		if ($count == 1){
  			return $arr[$k] = $v;
  		}
  		elseif ($count > 1)
  		{
  			$prev = '';
  			$loop = 1;
  			$unshift = $nested;
  
  			foreach ($nested as $part)
  			{
  				if (isset($arr[$part]) && $count > $loop)
  				{
  					$prev = $part;
  					array_shift($unshift);
  					$loop++;
  					continue;
  				}
  				else
  				{
  					if ( $loop > 1 && $loop < $count )
  					{
  						if( !isset($arr[$prev][$part]) ) $arr[$prev][$part] = [];
  
  						$arr[$prev] = static::set($arr[$prev], $unshift, $v);
  						$loop++; break;
  					}
  					elseif ( $loop >= 1 && $loop == $count )
  					{
  						if ( !is_array($arr[$prev]) ) $arr[$prev] = [];
  
  						if ($part == '')
  							$arr[$prev][] = $v;
  						else
  							$arr[$prev][$part] = $v;
  					}else{
  						$arr[$part] = [];
  						$prev = $part;
  						array_shift($unshift);
  						$loop++;
  					}
  				}
  	        }
  		}
  		return $arr;
  	}
docs: set value to nested array.
  
  @param array 	$arr
  @param string    $k
  @param mixed 	$v
  
  @return array