so I have this JSON object, which I have converted into a PHP object, for example I can use $apiobject->Response->DataItems and get a response.
This is stored in a class called returnjsonObject with a public function called getJsonObject.
In the same file how can I populate another class using the data from this $apiobject into something like:
class Response
{
public $StatusCode;
}
Then how can I for example echo out $StatusCode
Here is part of my file:
class Response
{
public $StatusCode; //*I want this to equal $apiobject->Response->DataItems*
}
class returnjsonObject{
public function getJsonObject()
{
echo"<pre>";
$apiobject = json_decode($response);
var_dump($apiobject->Response->DataItems);
echo"<pre>";
}
I've heard of using $this but I have to admit I don't understand it.
tl;dr I need to use $apiobject to populate $StatusCode using $apiobject->Response->DataItems
Hope you understand my question :-)