I have a users object returned from the database that looks like this:
[
    {
        "id":1,
        "name":"Bob",
        "category":"admin",
        "email":"[email protected]",
        "phone":"123456789",
        "gender":"male",
    },
    {
        "id":2,
        "name":"John",
        "category":"user",
        "email":"[email protected]",
        "phone":"123456789",
        "gender":"male",
    },
    {
        "id":3,
        "name":"Jane",
        "category":"admin",
        "email":"[email protected]",
        "phone":"123456789",
        "gender":"female",
    },
]
Now I want to loop through all the users object and remove all users whose category attribute is user so that the resulting users object only remains with admin category. 
I want to do this with a foreach loop. please how do I go about this or what better ways can I accomplish this?



