title: php detecting undefined propery in json objects
body: <p>I get some user information from linked api as json objects. I parse the json using json_decode method. It works just fine. My problem is when a field doesn't exist in the json. For example position object sometimes won't have the endDate property. </p>
  
  <pre><code>    $endDate = $user-&gt;positions-&gt;values[$i]-&gt;endDate-&gt;year."-".$user-&gt;positions-&gt;values[$i]-&gt;endDate-&gt;month."-01"; 
  </code></pre>
  
  <p>when the endDate property doesn't exist it gives me the undefined propery error. and code fails. I tried to use try catch but it still gives the error in try. im a newbie php coder. How should I detect that a property is undefined before making a call to that property?</p>