-1

I have following array from google api and wanted to get id only. How do i get id's from following. when i try to get size it gives me size zero.

Google_Service_Drive_FileList Object ( [collection_key:protected] => items
 [internal_gapi_mappings:protected] => Array ( ) [etag] => [itemsType:protected] 
=> Google_Service_Drive_DriveFile [itemsDataType:protected] => array [kind] => 
[nextLink] => [nextPageToken] => [selfLink] => [modelData:protected] => Array ( 
[items] => Array ( [0] => Array ( [id] => 0B0OnHwH_cQckeWZPdXFyRU5aMGs ) [1] => 
Array ( [id] => 0B0OnHwH_cQckaUVORkZaM2NoRXM ) [2] => Array ( [id] => 
1kCQLhEgzgeKO-L57ISWjQL4ctkxT4Gq2wrdzDFbrcac ) [3] => Array ( [id] => 
0B0OnHwH_cQckc3RhcnRlcl9maWxl ) [4] => Array ( [id] => 1-Yhs92vZnvUNArwAcZJZ9xa-
fXZ7ZgRrADyF-ikG1gU ) ) ) [processed:protected] => Array ( ) ) Array ( )
Sam
  • 2,935
  • 1
  • 19
  • 26

1 Answers1

0

if you mean the object attributes, you can do

$values = array();
$keys = array();
foreach($object as $key=>$value)
{
array_push($keys,$key);
array_push($values,$value);
}

This will give you each object attribute and its corresponding value

joshpj1
  • 186
  • 1
  • 1
  • 9