src/Zicht/Tool/PropertyPath/PropertyAccessor.php
public static function setByPath(&$subject, array $path, $value)
    {
        $ptr = & $subject;
        foreach ($path as $key) {
            if (is_object($ptr)) {
                if (!isset($ptr->$key)) {
                    $ptr->$key = array();
                }
                $ptr = & $ptr->$key;
            } elseif (is_array($ptr)) {
                if (!isset($ptr[$key])) {
                    $ptr[$key] = array();
                }
                $ptr = & $ptr[$key];
            }
        }
        $ptr = $value;
        return $subject;
    }
public static function setByPath(&$subject, array $path, $value)
    {
        $ptr = & $subject;
        foreach ($path as $key) {
            if (is_object($ptr)) {
                if (!isset($ptr->$key)) {
                    $ptr->$key = array();
                }
                $ptr = & $ptr->$key;
            } elseif (is_array($ptr)) {
                if (!isset($ptr[$key])) {
                    $ptr[$key] = array();
                }
                $ptr = & $ptr[$key];
            }
        }
        $ptr = $value;
        return $subject;
    }
public static function setByPath ( & $ subject , array $ path , $ value ) { $ ptr = & $ subject ; foreach ( $ path as $ key ) { if ( is_object ( $ ptr ) ) { if ( ! isset ( $ ptr -> $ key ) ) { $ ptr -> $ key = array ( ) ; } $ ptr = & $ ptr -> $ key ; } elseif ( is_array ( $ ptr ) ) { if ( ! isset ( $ ptr [ $ key ] ) ) { $ ptr [ $ key ] = array ( ) ; } $ ptr = & $ ptr [ $ key ] ; } } $ ptr = $ value ; return $ subject ; }
Set a property value by a path of property or key names.

@param mixed &$subject
@param array $path
@param mixed $value
@return mixed
Set a property value by a path of property or key names .