original_string: public static function removeFromArray(&$array, $keychain)
      {
          if (!is_array($array)) {
              $array = [];
          }
          if (!is_array($keychain)) {
              $keychain = [$keychain];
          }
  
          $headKey = array_shift($keychain);
          if (empty($keychain)) {
              //last
              unset($array[$headKey]);
          } else {
              //not last
              if (isset($array[$headKey])) {
                  self::removeFromArray($array[$headKey], $keychain);
              }
          }
      }
code: public static function removeFromArray(&$array, $keychain)
      {
          if (!is_array($array)) {
              $array = [];
          }
          if (!is_array($keychain)) {
              $keychain = [$keychain];
          }
  
          $headKey = array_shift($keychain);
          if (empty($keychain)) {
              //last
              unset($array[$headKey]);
          } else {
              //not last
              if (isset($array[$headKey])) {
                  self::removeFromArray($array[$headKey], $keychain);
              }
          }
      }
code_tokens: public static function removeFromArray ( & $ array , $ keychain ) { if ( ! is_array ( $ array ) ) { $ array = [ ] ; } if ( ! is_array ( $ keychain ) ) { $ keychain = [ $ keychain ] ; } $ headKey = array_shift ( $ keychain ) ; if ( empty ( $ keychain ) ) { //last unset ( $ array [ $ headKey ] ) ; } else { //not last if ( isset ( $ array [ $ headKey ] ) ) { self :: removeFromArray ( $ array [ $ headKey ] , $ keychain ) ; } } }
docstring: Unset item and nested item in array
  @since 1.2
  @param array $array
  @param array|string|int $keychain
docstring_tokens: Unset item and nested item in array