0

alt text

In the screenshot, you can see i have an array of arrays. I need to find an array that contains say, 'Russia', and unset it completely. That is, for Russia, remove the element [303].

I've played around with array search but I'm sure theres a funkier way of doing this.

Chris.

2 Answers 2

3
$array = your array;
foreach ($array as $key => $value) {
   if ($value['countryName'] == 'Russia') {
      unset($array[$key]);
   }
}
Sign up to request clarification or add additional context in comments.

Comments

0

and if you want reorder the key , you could use:

$new_array = array_values($array);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.