I have a foreach loop that iterates through an array but I want to check if the array contains $item == 'survey-east-upper' and if that's true then hide the previous $item which is 'survey-east'. I've looked into in_array but can't figure how to remove the previous element.
My original code:
foreach ($survey_array->Services as $service) {
  foreach ($service as $item) {
    echo '<li title="' . rtrim($item) . '" class="' . strtolower(preg_replace('/[^a-zA-Z0-9]/', '-', rtrim($item))) . '">' . $item . '</li>';
    }
  }
The new code:
foreach ($survey_array->Services as $service) {
  foreach ($service as $item) {
    if (in_array("survey-east-upper", $survey_array->Services)) {
       unset($site->Services['survey-east']);
    }
    echo '<li title="' . rtrim($item) . '" class="' . strtolower(preg_replace('/[^a-zA-Z0-9]/', '-', rtrim($item))) . '">' . $item . '</li>';
    }
  }
How can I accomplish this?
 
     
    