title: How to check success or error in json response in php function
body: <p>Json response returns</p>
  
  <pre><code>HTTP/1.0 200 OK Cache-Control: no-cache Content-Type: application/json
  Date: Mon, 20 Jul 2015 09:24:20 GMT {"success":true}`
  </code></pre>
  
  <p>or </p>
  
  <pre><code>HTTP/1.0 200 OK Cache-Control: no-cache Content-Type: application/json 
  Date: Mon, 20 Jul 2015 09:24:20 GMT {"error":"Trying to get property of non-object"}
  </code></pre>
  
  <p>How to write php code to check wether there is success or error.</p>
  
  <p>Doing it like this</p>
  
  <pre><code>$abc=$this-&gt;store($values,$reallocation_type,'multiple');
  
                      if(strpos($abc,'success') !== false)
                      {
                          echo "YES";
                      }
  </code></pre>