First, we see $cached is an object returned from cache_get function in

  if ($cached = cache_get('variables', 'cache_bootstrap')) {
    $variables = $cached->data;
  }

But from function getMultiple inside cache_get function

 foreach ($result as $item) {
        $item = $this->prepareItem($item);
        if ($item) {
          $cache[$item->cid] = $item;
        }
      }
//--
return $cache;

Showing that $cache is an array.

So we see there is a sudden change from array to object.
Can some one help us to make it clear.

Thanks and Regards.

Comments

Stefan Lehmann’s picture

getMultiple(), as the name clearly suggests, returns multiple cache objects?

I like cookies!

qqboy’s picture

because when we use

reset(array('jack'=array(1,2,3)));

Then it will return

array(1,2,3);

The secret is reset function -- POINT to the first element and return it.

Stefan Lehmann’s picture

Uhm .. and what has that to do with the initial question?

I like cookies!

qqboy’s picture

my initial question is ask why an array suddenly changed to an object.
And the answer is said.