You want to instantiate your object one time, setting $xml as a reference to that, then you want to invoke methods of that one object as-needed. If those methods return a useful value, capture it. But don't replace the value of the variable that refers to the object you're invoking!