public static function set(&$array, $key = null, $value = null, $opr = null)
    {
        if (null === $value) {
            return $array;
        }
        if (null === $key) {
            return $array = $value;
        }
        if (null === $opr) {
            return $array[$key] = $value;
        }

        $keys = explode($opr, $key);
        foreach ($keys as $key) {
            if (!isset($array[$key]) || !is_array($array[$key])) {
                $array[$key] = [];
            }

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

        $array = $value;

        return $array;
    }
public static function set(&$array, $key = null, $value = null, $opr = null)
    {
        if (null === $value) {
            return $array;
        }
        if (null === $key) {
            return $array = $value;
        }
        if (null === $opr) {
            return $array[$key] = $value;
        }

        $keys = explode($opr, $key);
        foreach ($keys as $key) {
            if (!isset($array[$key]) || !is_array($array[$key])) {
                $array[$key] = [];
            }

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

        $array = $value;

        return $array;
    }
public static function set ( & $ array , $ key = null , $ value = null , $ opr = null ) { if ( null === $ value ) { return $ array ; } if ( null === $ key ) { return $ array = $ value ; } if ( null === $ opr ) { return $ array [ $ key ] = $ value ; } $ keys = explode ( $ opr , $ key ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ array [ $ key ] ) || ! is_array ( $ array [ $ key ] ) ) { $ array [ $ key ] = [ ] ; } $ array = & $ array [ $ key ] ; } $ array = $ value ; return $ array ; }
Set an array item to a given value using "operator" notation.

@param array  $array Array to be evaluated.
@param string $key   Key
@param mixed  $value Value
@param string $opr   Notation like 'dot'

@since 3.0.0

@return array
Set an array item to a given value using operator notation .