执行函数后,对象的内容会发生变化

There are two objects of the same class:

$obj1 = new MyClass();
$obj2 = new MyClass();

Then I applied a function func to $obj2. However, once this function is executed, I noticed that the content of $obj1 has magically changed as well. I do not use any reference to $obj1 inside func. What might be the possible reasons of this problem? How do I solve it?

$obj2 = func($obj2,$vars);

I should say that I use other functions before func, and they also use $obj2 as an input. However, after their execution the content of $obj1 get not changed.

P.S. When I debug this code in Zend Studio and go inside func, Watch list Expressions says that $obj1 = null, but I think it's fine, because func is saved in a different PHP file.

Consider this:

class MyClass
{
  public static $value;

  public function test( $testvalue )
  {
    self::value = $testvalue;
  }
}

$obj1 = new MyClass();
$obj2 = new MyClass();

$obj1->test( 123 );

echo $obj2::value; // this will echo 123!!

There are no changes to made to $obj2, only to $obj1. The static causes the var to loose its object contents, and becomes 'global' to all objects.