title: compare object properties and show diff in PHP
body: <p>I'm searching for a way to show me the different properties/values from given objects...</p>
  
  <pre><code>$obj1 = new StdClass; $obj1-&gt;prop = 1;
  $obj2 = new StdClass; $obj2-&gt;prop = 2;
  
  var_dump(array_diff((array)$obj1, (array)$obj2));
  //output array(1) { ["prop"]=&gt; int(1) }
  </code></pre>
  
  <p>This works very well as long the property is not a object or array.</p>
  
  <pre><code>$obj1 = new StdClass; $obj1-&gt;prop = array(1,2);
  $obj2 = new StdClass; $obj2-&gt;prop = array(1,3); 
  
  var_dump(array_diff((array)$obj1, (array)$obj2))
  // Output array(0) { }
  // Expected output - array { ["prop"]=&gt; array { [1]=&gt; int(2) } }
  </code></pre>
  
  <p>Is there a way to get rid of this, even when the property is another object ?!</p>