title: Immutable objects in PHP?
body: <p>Is it a good idea to create objects that cannot be changed in PHP?</p>
  
  <p>For example a date object which has setter methods, but they will always return a new instance of the object (with the modified date).</p>
  
  <p>Would these objects be confusing to other people that use the class, because in PHP you usually expect the object to change?</p>
  
  <p>Example</p>
  
  <pre><code>$obj = new Object(2);
  
  $x = $obj-&gt;add(5); // 7
  $y = $obj-&gt;add(2); // 4
  </code></pre>