I have two stdclass objects namely
stdClass Object
(
[apple] => 10
[orange] => 10
[grape] => 10
[banana] => 20
[mango] => 30
)
stdClass Object
(
[apple] => 15
)
Can I update apple like a normal array operation? Or is there another way to do so?
Also whats the difference between this and a normal array?
You would loop through them using a normal
foreach
loop:or you could cast them as an your objects as an array using
(array)
.Live Example
Repl
Reading Material
Iterations