src/util/Arr.php
public static function set_path(&$array, $path, $value, $delimiter = null): void {
        if (!$delimiter) {
            // Use the default delimiter
            $delimiter = static::$delimiter;
        }

        // The path has already been separated into keys
        $keys = $path;
        if (!is_array($path)) {
            // Split the keys by delimiter
            $keys = explode($delimiter, $path);
        }

        // Set current $array to inner-most array path
        while (count($keys) > 1) {
            $key = array_shift($keys);

            if (is_string($key) && ctype_digit($key)) {
                // Make the key an integer
                $key = (int)$key;
            }

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

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

        // Set key on inner-most array
        $array[array_shift($keys)] = $value;
    }
public static function set_path(&$array, $path, $value, $delimiter = null): void {
        if (!$delimiter) {
            // Use the default delimiter
            $delimiter = static::$delimiter;
        }

        // The path has already been separated into keys
        $keys = $path;
        if (!is_array($path)) {
            // Split the keys by delimiter
            $keys = explode($delimiter, $path);
        }

        // Set current $array to inner-most array path
        while (count($keys) > 1) {
            $key = array_shift($keys);

            if (is_string($key) && ctype_digit($key)) {
                // Make the key an integer
                $key = (int)$key;
            }

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

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

        // Set key on inner-most array
        $array[array_shift($keys)] = $value;
    }
Set a value on an array by path.

@see Arr::path()
@param array $array Array to update
@param string $path Path
@param mixed $value Value to set
@param string $delimiter Path delimiter