title: php stdClass check for property exist
body: <p>I have read some similar issues here but unfortunately find the solution for my case.</p>
  <p>Some part of the output for an API connection is as;</p>
  <pre><code>stdClass Object (
      [page] =&gt; 0
      [items] =&gt; 5
      [total] =&gt; 5
      [saleItems] =&gt; stdClass Object (
          [saleItem] =&gt; Array (
              [0] =&gt; stdClass Object (
                  [reviewState] =&gt; approved
                  [trackingDate] =&gt; 2013-11-04T09:51:13.420+01:00
                  [modifiedDate] =&gt; 2013-12-03T15:06:39.240+01:00
                  [clickDate] =&gt; 2013-11-04T09:06:19.403+01:00
                  [adspace] =&gt; stdClass Object (
                      [_] =&gt; xxxxx
                      [id] =&gt; 1849681 
                  )
                  [admedium] =&gt; stdClass Object (
                      [_] =&gt; Version 3
                      [id] =&gt; 721152
                  )
                  [program] =&gt; stdClass Object (
                      [_] =&gt; yyyy
                      [id] =&gt; 10853
                  )
                  [clickId] =&gt; 1832355435760747520
                  [clickInId] =&gt; 0
                  [amount] =&gt; 48.31
                  [commission] =&gt; 7.25
                  [currency] =&gt; USD
                  [gpps] =&gt; stdClass Object (
                      [gpp] =&gt; Array (
                          [0] =&gt; stdClass Object (
                              [_] =&gt; 7-75
                              [id] =&gt; z0
                          )
                      )
                  )
                  [trackingCategory] =&gt; stdClass Object (
                      [_] =&gt; rers
                      [id] =&gt; 68722
                  )
                  [id] =&gt; 86erereress-a9e4-4226-8417-a46b4c9fd5df
              )
          )
      )
  )
  </code></pre>
  <p>Some strings do not include gpps property.</p>
  <p>What I have done is as follows</p>
  <pre><code>foreach($sales-&gt;saleItems-&gt;saleItem as $sale)
  {
      $status     = $sale-&gt;reviewState;
      
      if(property_exists($sale, gpps)) 
      {
          $subId      = $sale-&gt;gpps-&gt;gpp[0]-&gt;_;
      }else{
          $subId      = &quot;0-0&quot;;
      }
  }
  </code></pre>
  <p>What I want is I the gpps property is not included in that string $subId stored as 0-0 in db, otherwise get the data from the string. But it doesn't get the strings without gpps.</p>
  <p>Where is my mistake?</p>