title: Check Array for Object with Same Key
body: <p>I'm creating an array of objects (or trying to) that looks like this: </p>
  
  <pre><code>Array
  (
  [1] =&gt; stdClass Object
      (
          [date] =&gt; 2016-09-28
      )
  
  [5] =&gt; stdClass Object
      (
          [date] =&gt; 2016-09-28
      )
  
  [2] =&gt; stdClass Object
      (
          [date] =&gt; 2016-09-29
      )
  
  [0] =&gt; stdClass Object
      (
          [date] =&gt; 2016-09-30
      )
  
  [4] =&gt; stdClass Object
      (
          [date] =&gt; 2016-09-30
      )
  
  [3] =&gt; stdClass Object
      (
          [date] =&gt; 2016-09-30
      )
  
  )
  </code></pre>
  
  <p>The trouble that I'm having is that I need can't work out how to check if an object with <code>date-&gt;$date</code> already exists. </p>
  
  <p>I need an array of <code>'days'</code> that I can then go on to add workshops to the corresponding days, not to a new object each time. </p>
  
  <p>Can anyone make a suggestion? </p>
  
  <ul>
  <li><ul>
  <li><ul>
  <li>EDIT</li>
  </ul></li>
  </ul></li>
  </ul>
  
  <p>To put this in context, I'm iterating through a bunch of wordpress posts (of type 'workshop' in this case) which all have a piece of date meta. On my way through the loop I want to </p>
  
  <ul>
  <li>Get the date(day)</li>
  <li>Check if that date exists in the array</li>
  <li>If not, add the date to the array</li>
  <li>Then add the workshop object to that date array</li>
  </ul>
  
  <p>What I should therefor end up with is an array containing three or four unique dates, each with an array of workshop objects. </p>
  
  <pre><code>Array( 
    Date 1( 
      Workshop( 
        Title, etc 
      ),
      Workshop()
     )
    Date 2( 
      Workshop(
        Title, etc
      )
      Workshop()
    )
  )
  </code></pre>
  
  <p>My apologies, I'm sure my structure is off - this is a little advanced for me. Thanks for looking. </p>