sets an item from an array with dottet dimensions

@param string	$key
@param mixed		$value
@param array		$arr
@return array
500106
public static function set( $key, $value, &$arr ) 
	{	
		if ( strpos( $key, '.' ) === false ) 
		{
			$arr[$key] = $value;

		} 
		else 
		{
			$kp = explode( '.', $key );

			switch ( count( $kp ) ) 
			{
				case 2:
					$arr[$kp[0]][$kp[1]] = $value; break;
				case 3:
					$arr[$kp[0]][$kp[1]][$kp[2]] = $value; break;	
				case 4:
					$arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] = $value; break;

				// if there are more then 4 parts loop trough them
				default:
					$kp = array_reverse( $kp );
					$curr = $value;

					foreach( $kp as $k ) 
					{
						$curr = array( $k => $curr );
					}

					$arr = static::merge( $arr, $curr );
				break;
			}
		}
		return $arr;
	}
1090208
public static function assoc($arr, $keys) {
        $out = array();
        foreach ($arr as $cnt => $a) {
            $out[$keys[$cnt]] = $a;
        }

        return $out; 
      }
948870
public static function set(array &$array, string $key, $value)
    {
        foreach (\explode('.', $key) as $k) {
            if (!isset($array[$k]) || !\is_array($array[$k])) {
                $array[$k] = [];
            }
            $array = &$array[$k];
        }

        $array = $value;
    }
1135840
protected function setIntoArray(&$array, $keys, $value)
    {
        $k = array_shift($keys);

        if (is_scalar($array)) {
            $array = (array) $array;
        }

        if (!isset($array[$k])) {
            $array[$k] = null;
        }

        if (empty($keys)) {
            return $array[$k] = &$value;
        }

        return $this->setIntoArray($array[$k], $keys, $value);
    }
312481
protected function setValue($key, $value, array &$array = array())
    {
        $keys = $this->parseKey($key, $this->separator);
        $pointer = &$array;

        while (count($keys) > 0) {
            $key = array_shift($keys);
            $pointer[$key] = (isset($pointer[$key]) ? $pointer[$key] : array());
            $pointer = &$pointer[$key];
        }

        $pointer = $value;
        return $array;
    }
321252
public function setOptionArray(array $arr) {
        foreach($arr as $option => $value) {
            CurlOptions::checkOptionValue($option, $value);
        }

        return curl_setopt_array($this->handle, $arr);
    }
1323712
public static function remove(&$arr, $key, $default = null)
    {
        if (isset($arr[$key])) {
            $value = $arr[$key];
            unset($arr[$key]);
        } else {
            $value = $default;
        }

        return $value;
    }
62523
protected static function deleteMultiple(array &$arr, array $keys)
    {
        $return = [];
        foreach ($keys as $key) {
            $return[$key] = static::delete($arr, $key);
        }

        return $return;
    }
621335
static function getArray($arr,$key,$default=array())
    {
        $value = Utility::get($arr, $key);
        return ($value!=null)?explode(',', $value):$default;
    }
154205
function SetArr() {
  let arr = {}
  let set = {
    size: 0,
    clear() {
      set.size = 0
    },
    add(item) {
      let index = arr.indexOf(item)
      if (index !== -1) return arr
      arr.push(item)
      set.size = arr.length
      return set
    },
    delete(item) {
      let index = arr.indexOf(item)
      if (index === -1) return false
      arr.splice(index, 1)
      set.size = arr.length
      return true
    },
    [Symbol.iterator]: () => arr[Symbol.iterator]()
  }
  return set
}
1160041
public static function from_array($arr)
    {
        $obj = new rcube_message_header;
        foreach ($arr as $k => $v)
            $obj->set($k, $v);

        return $obj;
    }
475742
public static function array_append(&$arr, $path, $value) {
		if(!is_array($path))
			$path = [$path];
		$lastkey = array_pop($path);
		foreach($path as $parent)
			$arr =& $arr[$parent];
		$arr[$lastkey][] = $value;
	}
614110
public static function arrayRemove($arr, $key, $default = null)
    {
        if (isset($arr[$key])) {
            $value = $arr[$key];
            unset($arr[$key]);

            return $value;
        }

        return $default;
    }
112245
public function set($key, $value)
    {
        if (is_array($key) && $value === null)
            $args = $key;
        else
            $args = func_get_args();

        $value = array_pop($args);
        
        $parent = null;
        $key = null;
        $ref = &$this->values;
        foreach ($args as $arg)
        {
            if (!is_scalar($arg))
                throw new \InvalidArgumentException("Keys must be scalar, not: " . WF::str($arg));

            if (!is_array($ref))
            {
                if ($parent !== null)
                    $parent[$key] = array();
                $ref = &$parent[$key];
            }
                
            if (!isset($ref[$arg]))
                $ref[$arg] = array();

            $parent = &$ref;
            $key = $arg;
            $ref = &$ref[$arg];
        }

        // Unwrap Dictionary objects
        $cl = is_object($value) ? get_class($value) : null;
        if ($cl === Dictionary::class)
            $ref = $value->getAll();
        else
            $ref = $value;

        return $this;
    }
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;
    }
311589
private function GetArrayVal($arr,$key,$not_defined_val = "")
	{
		return array_key_exists($key,$arr)
			? $arr[$key]
			: $not_defined_val;
	}
213062
public function customize(array $arr): array
  {
    $res = [];
    if ( isset($arr[0]) ){
      foreach ( $arr as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          $res[] = $a;
        }
      }
    }
    else if ( isset($arr['items']) ){
      $res = $arr;
      unset($res['items']);
      foreach ( $arr['items'] as $a ){
        if ( isset($a['id']) && $this->has($a['id']) ){
          if ( !isset($res['items']) ){
            $res['items'] = [];
          }
          $res['items'][] = $a;
        }
      }
    }
    return $res;
  }