title: Extract Value from PHP Object
body: <p>I have been attempting to develop a PHP API for a website. I have followed the tutorials on the Internet that work fine.</p>
  
  <p>It works off the following url structure:<br>
  <code>http://localhost/mobileapi/search/dostuff/parameter1/parameter2/parameter3/parameter4/json={"name":"jumbo","age":"178","sex":"male"}</code></p>
  
  <pre><code>Command Object
  (
      [Name] =&gt; search
      [Function] =&gt; dostuff
      [Parameters] =&gt; Array
          (
              [0] =&gt; parameter1
              [1] =&gt; parameter2
              [2] =&gt; parameter3
              [3] =&gt; parameter4
              [4] =&gt; json={"name":"jumbo","age":"178","sex":"male"}
          )
  
  )
  </code></pre>
  
  <p>What I need to do is access these parameter values, the one I have been attempting first is probably the harder one being the json.</p>
  
  <p>What I have so far is:</p>
  
  <pre><code>    $params[] = $this-&gt;Command-&gt;getParameters();
      $json = urldecode($params[0][4]);
      $json = str_replace('json=', '', $json);
      $json = json_decode($json);
  </code></pre>
  
  <p>Providing me with:</p>
  
  <pre><code>stdClass Object
  (
      [name] =&gt; jumbo
      [age] =&gt; 78
      [sex] =&gt; male
  )
  </code></pre>
  
  <p>Which still ends up being an object.</p>
  
  <p>My end goal is to be able to receive JSON data to the API and then insert that into the database. I can't for the life of me find out how to take these last object values and store them in variables etc.</p>
  
  <p>Thank you :)</p>