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;
        }
    }
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;
        }
    }
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 ; } }
Set value in data.

@param mixed[] $array
@param string $key Uses dot notation.
@param mixed $value
@param bool $create Default false.
Set value in data .