title: compare two arrays of user-defined objects
body: <p>C++/Python guy here.</p>
  
  <p>I need to compare two php-arrays containig user-defined classes.</p>
  
  <pre><code>class Point
  {
    var $x;
    var $y;
  
    function _construct($x_, $y_)
    {
      $this -&gt; x = $x_;
      $this -&gt; y = $y_;
    }
  }
  
  $mas1 = array(new Point(0,1),new Point(0,1),new Point(0,1));   
  $mas2 = array(new Point(0,1),new Point(0,1),new Point(0,1)); 
  
  if (array_diff($mas1,$mas2) == array())
  {
    echo "they're equal\n";
  }
  </code></pre>
  
  <p>i got "Catchable fatal error: Object of class Point could not be converted to string". When i tried to use simple</p>
  
  <pre><code>if ($mas1 == $mas2)
  </code></pre>
  
  <p>i got False.</p>
  
  <p>Questions: 1) is there way to overload comparison operator for my class Point 2) how to compare two arrays containing user-defined classes correctly?</p>
  
  <p>Thank you.</p>
  
  <p>I use php 5.2.11</p>