title: If statement on a sub array of an object
body: <p>Hope that title made sense but my issue is i have an object with an array like this, this is just 1 from the array as an example</p>
  
  <pre><code>    object(stdClass)#6 (3) {
    ["items"]=&gt;
    array(40) {
      [0]=&gt;
      object(stdClass)#7 (22) {
        ["id"]=&gt;
        int(46)
        ["parentId"]=&gt;
        int(0)
        ["name"]=&gt;
        string(22) "Complete monthly wages"
        ["description"]=&gt;
        string(294) "Complete monthly wages&lt;span style=""&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;Complete monthly wages&lt;span style=""&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Complete monthly wages&lt;span style=""&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Complete monthly wages&lt;span style=""&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Complete monthly wages&lt;span style=""&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;"
        ["tags"]=&gt;
        string(0) ""
        ["projectId"]=&gt;
        int(12)
        ["ownerId"]=&gt;
        int(1)
        ["groupId"]=&gt;
        int(0)
        ["startDate"]=&gt;
        string(19) "2012-09-03T00:00:00"
        ["priority"]=&gt;
        int(2)
        ["progress"]=&gt;
        float(0)
        ["status"]=&gt;
        int(10)
        ["createdAt"]=&gt;
        string(19) "2012-09-03T07:35:21"
        ["updatedAt"]=&gt;
        string(19) "2012-09-03T07:35:21"
        ["notifyProjectTeam"]=&gt;
        bool(false)
        ["notifyTaskTeam"]=&gt;
        bool(false)
        ["notifyClient"]=&gt;
        bool(false)
        ["hidden"]=&gt;
        bool(false)
        ["flag"]=&gt;
        int(0)
        ["hoursDone"]=&gt;
        float(0)
        ["estimatedTime"]=&gt;
        float(0)
        ["team"]=&gt;
        object(stdClass)#8 (3) {
          ["items"]=&gt;
          array(2) {
            [0]=&gt;
            object(stdClass)#9 (1) {
              ["id"]=&gt;
              int(2)
            }
            [1]=&gt;
            object(stdClass)#10 (1) {
              ["id"]=&gt;
              int(1)
            }
          }
          ["count"]=&gt;
          int(2)
          ["total"]=&gt;
          int(2)
        }
      }
  </code></pre>
  
  <p>As we can see it has a team section and this is my focus</p>
  
  <pre><code>["team"]=&gt;
            object(stdClass)#8 (3) {
              ["items"]=&gt;
              array(2) {
                [0]=&gt;
                object(stdClass)#9 (1) {
                  ["id"]=&gt;
                  int(2)
                }
                [1]=&gt;
                object(stdClass)#10 (1) {
                  ["id"]=&gt;
                  int(1)
                }
              }
              ["count"]=&gt;
              int(2)
              ["total"]=&gt;
              int(2)
            }
          }
  </code></pre>
  
  <p>As you can see there is 2 id's in there, 1 and 2, there could be anything up to 30 or so but i cant figure out how to efficently tell it to search the whole array.</p>
  
  <p>If i use this it works as long as the Id 1 happens to be the first item in id but thats obviously not always the case. My aim is to search through the object and just run code IF the users ID is in the team array, im new to php and objects in particular so hope someone can point me in the right direction</p>
  
  <pre><code>foreach($tasksList-&gt;items as $task_details) 
  {
      if($task_details-&gt;team-&gt;items-&gt;id === 1)
      {
          echo "My Code";
  
      }
  
  
  }
  </code></pre>