Good afternoon, I have a difficulty, where I need to access an element of an array of OBJECTS, I'm not able to access with the foreach, or for. I need your help!
The array of objects:
Array
(
[0] => stdClass Object
(
[pk] => 1343200701115549070
)
[1] => stdClass Object
(
[pk] => 1339248324134135231
)
[2] => stdClass Object
(
[pk] => 1338844272896371640
)
[3] => stdClass Object
(
[pk] => 1338841774089501872
)
[4] => stdClass Object
(
[pk] => 1338838365890273563
)
I need to get the values from "pk" to putting in another variable. To complement the explanation, this array is a file in json_encode, where I open the file and transform it into json_decode:
$file = new SplFileObject($caminho);
while (!$file->eof()) {
$id_line1 = $file->fgets();
}
$id_line = json_decode($id_line1);
I love you