I have a json object , when looped through using a foreach outputs the below :
{"Comment": {"id":"1","post_id":"31","created":"14263241"} , "User": {"fname":"Test","lname":"Test2"} }
{"Comment": {"id":"2","post_id":"32","created":"14263257"} , "User": {"fname":"Lionel","lname":"Messi"} }
Where created is a timestamp .
Using a condition from another array , i want to be able to insert a new element in the second array so that it becomes like this :
{"Comment": {"id":"2","post_id":"32","created":"14263257"} , "User": {"fname":"Lionel","lname":"Messi"}, "Status":{"status":"add","userid":"10"} }
where "Status":{"status":"add","userid":"10"} will be from another json object .
Any help would be appreciated .