public function load($array, $filter=false)
    {
        // apply the optional filter
        if (is_array($filter)) {
            $array = array_intersect_key($array, array_fill_keys($filter, NULL));
        }

        foreach ($array as $key=>$value) {
            if(is_object($value) || is_array($value))
                $this->$key = $value;
            else
                $this->__set($key, $value);
        }

        return $this;
    }
public function load($array, $filter=false)
    {
        // apply the optional filter
        if (is_array($filter)) {
            $array = array_intersect_key($array, array_fill_keys($filter, NULL));
        }

        foreach ($array as $key=>$value) {
            if(is_object($value) || is_array($value))
                $this->$key = $value;
            else
                $this->__set($key, $value);
        }

        return $this;
    }
public function load ( $ array , $ filter = false ) { // apply the optional filter if ( is_array ( $ filter ) ) { $ array = array_intersect_key ( $ array , array_fill_keys ( $ filter , NULL ) ) ; } foreach ( $ array as $ key => $ value ) { if ( is_object ( $ value ) || is_array ( $ value ) ) $ this -> $ key = $ value ; else $ this -> __set ( $ key , $ value ) ; } return $ this ; }
Loads an array of values into the object
@param $filter only processes the keys listed, or false for all
@chainable
Loads an array of values into the object