Using twig extensions in Drupal 7
When you are using tfd7 you can use extensions, functions, etc. The easiest way to go is to create an own module for handling all the php-functions.

In your OWN_MODULE.module:

function OWN_MODULE_twig_function() {
  $functions = [];
  $functions['XYZ_unset_key'] = new TwigSimpleFunction('XYZ_unset_key', 'XYZ_unset_key_callable');

  ...

  return $functions;
}

function XYZ_unset_key_callable($key, $array) {
  unset($array[$key];
  return $array;
}


After that you can use the function XYZ_unset_key in your twig-files:

&lt;div&gt;
  {{ XYZ_unset_key('field_xyz', 'content') }}
&lt;/div&gt;