I iterate through an array of objects and want to delete one of the objects based on it\'s \'id\' property, but my code doesn\'t work.
foreach($array as $ele
You can also use references on foreach values:
foreach
foreach($array as $elementKey => &$element) { // $element is the same than &$array[$elementKey] if (isset($element['id']) and $element['id'] == 'searched_value') { unset($element); } }