title: How do you build persistent object identity in PHP?
body: <p>I have the next issue:</p>
  
  <p>I'm trying to form up an identity of an array of objects that I save. This identy, I will, upon generation of these objects, check again and see if it's identical or different from the newly resulted idenity of the new generation -- if it is, update my database with this identity (which should be a unique string), otherwise, I don't do anything. The code is as follows:</p>
  
  <pre><code>class GoodSuggestion {}
  class BadSuggestion {}
  class MiscSuggestion {}
  
  $container_items = [new GoodSuggestion, new BadSuggestion, new MiscSuggestion];
  
  $identity = createIdentityFromObjects( $container_items );
  
  //If my identity from NOW doesn't match the past identity, it means we have a new object inside
  if( $identity != retrievePastIdentityFromDatabase() ) {
  
      //And so, we re-generate the suggestions
      $generated_suggestions = $generator-&gt;generateSuggestion( $container_items );
  
      //and update the database with the new identity so that in the future, before we generate, we can check again.
      updateIdentityInTheDatabase( $identity );
  }
  </code></pre>
  
  <p>How can I reliably build identity for an object, given my requirements?</p>
  
  <p>I will have cases where an object is of the same <code>Base_Object</code>, so I need to compute the data inside too.</p>
  
  <p>I do acknowledge the limitation of not being able to compute differences between implementation details (such as a single character being added to the same, otherwise identical class). This needs to compute an indentity string based on reasonable terms.</p>