Getting error in while using views with php

Hello,
I have following code to retrieve data using view,

$bucket = $cluster->openBucket('beer-sample');
$query = CouchbaseViewQuery::from('beer', 'by_location')->skip(6)->limit(2)->reduce(false)->order(CouchbaseViewQuery::ORDER_ASCENDING);
$results = $bucket->query($query);

foreach($results['rows'] as $row) {
    var_dump($row['key']);
}

But I am getting this error

FatalErrorException in CouchbaseBucket.class.php line 284:Cannot use object of type stdClass as array

Can anyone help me to solve this error?

Thanks.

@sp111, I had a similar error, further down in this discussion:

Please report if the response I got also works for you.

Thank you very much @SimonSimCity, it worked…