I want to add some value here:
Array
(
[0] => stdClass Object
(
[id] => 1
[cat_id] => 1
[lot_id] => 1
[brand] => Dell
[model] => D630
[unit_aed] => 800
[sold] => 0
** i want to append value here like this
[username] => name
)
[2] => stdClass Object
(
[id] => 4
[cat_id] => 0
[lot_id] => 0
[brand] => dell
[model] => e6400
[unit_aed] => 0
[sold] => 0
)
)
How this possible? I’m trying with array_push($array, 'username').
It works fine with simple array but not work with stdClass Object array.
Add another object key and value:
Or you can add
usernameto every value in that object: