private function _changedAttribute($attr) 
    {
        preg_match('/(\w+)_(change|changed|was)$/', $attr, $matches);
        if (sizeof($matches) < 1) {
            return null;
        }

        $attr = $matches[1];
        $meth = $matches[2];
        $cur  = $this->get($attr);
        $old  = $this->get($attr, false);

        if ($meth == "was") {
            return $old;
        }
        if ($meth == "changed") {
            return $cur!=$old;
        }
        if ($meth == "change") {
            return array($old, $cur);
        }
        return null;
    }
private function _changedAttribute($attr) 
    {
        preg_match('/(\w+)_(change|changed|was)$/', $attr, $matches);
        if (sizeof($matches) < 1) {
            return null;
        }

        $attr = $matches[1];
        $meth = $matches[2];
        $cur  = $this->get($attr);
        $old  = $this->get($attr, false);

        if ($meth == "was") {
            return $old;
        }
        if ($meth == "changed") {
            return $cur!=$old;
        }
        if ($meth == "change") {
            return array($old, $cur);
        }
        return null;
    }
private function _changedAttribute ( $ attr ) { preg_match ( '/(\w+)_(change|changed|was)$/' , $ attr , $ matches ) ; if ( sizeof ( $ matches ) < 1 ) { return null ; } $ attr = $ matches [ 1 ] ; $ meth = $ matches [ 2 ] ; $ cur = $ this -> get ( $ attr ) ; $ old = $ this -> get ( $ attr , false ) ; if ( $ meth == "was" ) { return $ old ; } if ( $ meth == "changed" ) { return $ cur != $ old ; } if ( $ meth == "change" ) { return array ( $ old , $ cur ) ; } return null ; }
Check if an attribute changed its value since object was loaded

@param string $attr attribute

@return changed or not
Check if an attribute changed its value since object was loaded