How to read results from phpParticle?

Im trying to read a returned value from getvariable, However, when echo the value I get ‘Array’

Thanks for help

Here’s my code


 

       // Grab a new instance of our phpSpark object
        $spark = new phpSpark();
    
        // Set the internal debug to true. Note, calls made to $spark->debug(...) by you ignore this line and display always
        $spark->setDebug(false);
        // Set the debug calls to display pretty HTML format. Other option is "TEXT". Note, calls made to $spark->debug(...) display as set here
       // $spark->setDebugType("HTML");
    
        // Set our access token (set in the phpConfig.config.php file)
        $spark->setAccessToken($accessToken);
    
         // Grab the current uptime of your core (requires a modified version of tinker on your Spark Core)
         //$spark->debug("Spark Variable");
         
         if($spark->getVariable($deviceID, $atts['variable']) == true)
         {
         
            // $spark->debug_r($spark->getResult());
    
         }
         else
         {
            // $spark->debug("Error: " . $spark->getError());
            // $spark->debug("Error Source" . $spark->getErrorSource());
            $getValue = null;
         }
    
        return ($spark->getResult());
    }

If the echo command returns the ‘Array’ string means your returned variable ($spark->getResult()) is an array and between elements of the array should be the expected value (if getVariable not fail) . For testing on an array or an object in php using var_dump () or print_r() instead of echo and after you’ve figured out how the array is formed you can take your values from it.

Thanks. I got it to work with your help.
To read value it’s.
$getvalue=$spark->getResult();
Return ($getvalue[‘result’]);