public static function insert(array $set, $path, $value) {
        if (!$path) {
            return $set;
        }

        // Exit early for faster processing
        if (strpos($path, '.') === false) {
            $set[$path] = $value;

            return $set;
        }

        $search =& $set;
        $paths = explode('.', $path);
        $total = count($paths);

        while ($total > 0) {
            $key = $paths[0];

            // Within the last path
            if ($total === 1) {
                $search[$key] = $value;

            // Break out of non-existent paths early
            } else if (!array_key_exists($key, $search) || !is_array($search[$key])) {
                $search[$key] = array();
            }

            $search =& $search[$key];
            array_shift($paths);
            $total--;
        }

        unset($search);

        return $set;
    }
public static function insert(array $set, $path, $value) {
        if (!$path) {
            return $set;
        }

        // Exit early for faster processing
        if (strpos($path, '.') === false) {
            $set[$path] = $value;

            return $set;
        }

        $search =& $set;
        $paths = explode('.', $path);
        $total = count($paths);

        while ($total > 0) {
            $key = $paths[0];

            // Within the last path
            if ($total === 1) {
                $search[$key] = $value;

            // Break out of non-existent paths early
            } else if (!array_key_exists($key, $search) || !is_array($search[$key])) {
                $search[$key] = array();
            }

            $search =& $search[$key];
            array_shift($paths);
            $total--;
        }

        unset($search);

        return $set;
    }
public static function insert ( array $ set , $ path , $ value ) { if ( ! $ path ) { return $ set ; } // Exit early for faster processing if ( strpos ( $ path , '.' ) === false ) { $ set [ $ path ] = $ value ; return $ set ; } $ search = & $ set ; $ paths = explode ( '.' , $ path ) ; $ total = count ( $ paths ) ; while ( $ total > 0 ) { $ key = $ paths [ 0 ] ; // Within the last path if ( $ total === 1 ) { $ search [ $ key ] = $ value ; // Break out of non-existent paths early } else if ( ! array_key_exists ( $ key , $ search ) || ! is_array ( $ search [ $ key ] ) ) { $ search [ $ key ] = array ( ) ; } $ search = & $ search [ $ key ] ; array_shift ( $ paths ) ; $ total -- ; } unset ( $ search ) ; return $ set ; }
Inserts a value into the array set based on the given path.

@param array $set
@param string $path
@param mixed $value
@return array
Inserts a value into the array set based on the given path .