I would like to loop through my object with object syntax - foreach .. $prop->val but I get an error that it is not an object.
Here is my object:
stdClass Object
(
[calls] => Array
(
[0] => stdClass Object
(
[employee_id] => 47
[call_duration] => 10
)
[1] => stdClass Object
(
[employee_id] => 47
[call_duration] => 10
)
[2] => stdClass Object
(
[employee_id] => 47
[call_duration] => 137
)
It was created like this:
$all_calls->calls[] = [
'employee_id' => $employee_id,
'call_duration' => $value->duration
];
How can I loop through "calls" without using array syntax $call["employee_id"] but instead $call->employee_id?
$call = (object) $call