public static function setNestedArrayValue(array &$array, array $parents, $value, $force = false)
    {
        $ref = &$array;
        foreach ($parents as $parent) {
            // PHP auto-creates container arrays and NULL entries without error if $ref
            // is NULL, but throws an error if $ref is set, but not an array.
            if ($force && isset($ref) && !is_array($ref)) {
                $ref = [];
            }
            $ref = &$ref[$parent];
        }
        $ref = $value;
    }
public static function setNestedArrayValue(array &$array, array $parents, $value, $force = false)
    {
        $ref = &$array;
        foreach ($parents as $parent) {
            // PHP auto-creates container arrays and NULL entries without error if $ref
            // is NULL, but throws an error if $ref is set, but not an array.
            if ($force && isset($ref) && !is_array($ref)) {
                $ref = [];
            }
            $ref = &$ref[$parent];
        }
        $ref = $value;
    }
public static function setNestedArrayValue ( array & $ array , array $ parents , $ value , $ force = false ) { $ ref = & $ array ; foreach ( $ parents as $ parent ) { // PHP auto-creates container arrays and NULL entries without error if $ref // is NULL, but throws an error if $ref is set, but not an array. if ( $ force && isset ( $ ref ) && ! is_array ( $ ref ) ) { $ ref = [ ] ; } $ ref = & $ ref [ $ parent ] ; } $ ref = $ value ; }
Set a nested value in an array.

@see Copied from \Drupal\Component\Utility\NestedArray::setValue()

@param array &$array
@param array $parents
@param mixed $value
@param bool  $force
Set a nested value in an array .