Q: Remove the item from array based on child value on object I've got the following data structure:
Array -> Object -> Array -> Object -> Object
[
   {
      "id":6834,
      "contract_id":13,
      "schedule_column_values":[
         {
            "id":34001,
            "field_value":{
               "id":324241,
               "value":10,
               "field":{
                  "id":1,
                  "signature":"ios"
               }
            }
         },
         {
            "id":34001,
            "field_value":{
               "id":324241,
               "value":10,
               "field":{
                  "id":1,
                  "signature":"android"
               }
            }
         }
      ]
   }
]

What I'm trying to achieve is that if a field has the signature of "android", remove its grandparent object from schedule_column_values. Basically, if a signature is "android", the final data would look like this:
[
  {
    "id": 6834,
    "contract_id": 13,
    "schedule_column_values": [
      {
        "id": 34001,
        "field_value": {
          "id": 324241,
          "value": 10,
          "field": {
            "id": 1,
            "signature": "ios"
          }
        }
      }      
    ]
  }
  ]

This is just an example but the structure is always the same and we always know what signature we're looking for. It could be anything other than android but we know the string we're looking for.
I've tried a nested foreach loop and tried unset but it doesn't seem to work. The other way is I've set a NULL to object value of schedule_column_values when the signature of field is matched, but I cannot have NULL in the object.
What would be a good way to filter out this structure?

A: This is a perfect use case for array_filter:
$filtered_array = [];

foreach($array as $grandparent){
    $filtered_schedules = array_filter(
        $grandparent->schedule_column_values, 
        function($item){
            return $item->field_value->field->signature !== 'android';
        }
    );

    $altered_grandparent = clone $grandparent;
    $altered_grandparent->schedule_column_values = $filtered_schedules;

    $filtered_array[] = $altered_grandparent;
}

