title: Check if a particular JSON Object is available or not in php
body: <p>I have following JSON:</p>
  
  <pre><code>$p={
    "main1" : [
      {
        "child1" : valueA,
        "child2" : valueB,
        "child3" : valueC,
      },
      {
        "child1" : value1,
        "child3" : value3,
      },
    ],
    "main2" : "valueMain2"
  }
  </code></pre>
  
  <p>The element <code>child2</code> has to be checked if it exists or not and then the value is taken. I am using json_decode:</p>
  
  <pre><code>$response = json_decode($p,true);
  </code></pre>
  
  <p>How do I check if an element exists or not in PHP? Do I have to make separate function or is there built-in functionality?</p>