I assume the array was in JSON format? Anyway .. I fixed your invalid JSON so you can see how this is done.
$json = ' [{ "id": 1, "name": "Bob", "category": "admin", "email": " test1@test.com ", "phone": "123456789", "gender": "male" }, { "id": 2, "name": "John", "category": "user", "email": " john@test.com ", "phone": "123456789", "gender": "male" }, { "id": 3, "name": "Jane", "category": "admin", "email": " jane@test.com ", "phone": "123456789", "gender": "female" }] '; $array = json_decode($json, true); //Fixed and converted JSON into PHP Assoc Array foreach($array as $k=>$v) { foreach ($array[$k] as $key=>$value) { if ($key === "category" && $value === "user") { //If Value of 2D is equal to user and cat unset($array[$k]); //Delete from Array } } } var_dump($array); //Output Array
Exit
array(2) { [0] => array(6) { ["id"] => int(1)["name"] => string(3) "Bob" ["category"] => string(5) "admin" ["email"] => string(14) " test1@test.com " ["phone"] => string(9) "123456789" ["gender"] => string(4) "male" }[2] => array(6) { ["id"] => int(3)["name"] => string(4) "Jane" ["category"] => string(5) "admin" ["email"] => string(13) " jane@test.com " ["phone"] => string(9) "123456789" ["gender"] => string(6) "female" } }
Edit
* As @sevavietl noted in the comments, if any other element of the array was called by the user, this will be deleted. I changed the code to check the key (category) as well as the value. *
source share