code: public static function remove(&$data, $path, $default = null)
      {
          if (!static::$unsetMarker) {
              static::$unsetMarker = new \stdClass();
          }
  
          // Call get() with special default value so we can know if the key exists without calling has()
          $value = static::get($data, $path, static::$unsetMarker);
  
          /*
           * If the path doesn't exist don't call set().
           * This also prevents set() from creating middle arrays to get to the leaf node,
           * which doesn't make sense in this case since we are just trying to remove the leaf node.
           */
          if ($value === static::$unsetMarker) {
              return $default;
          }
  
          // Set with special marker to unset value at path
          static::set($data, $path, static::$unsetMarker);
  
          return $value;
      }
docs: Removes and returns a value from an array or `ArrayAccess` object using path syntax to remove nested data.
  
  Example:
  
  Arr::remove($data, 'foo/bar');
  // => 'baz'
  Arr::remove($data, 'foo/bar');
  // => null
  
  This function does not support keys that contain `/`.
  
  <br>
  Note: To remove values in arrays that are in `ArrayAccess` objects their
  `offsetGet()` method needs to be able to return arrays by reference.
  See {@see MutableBag} for an example of this.
  
  @param array|ArrayAccess $data    Data to retrieve remove value from
  @param string            $path    Path to traverse
  @param mixed|null        $default Default value to return if key does not exist
  
  @throws \RuntimeException when trying to remove a path that travels through a scalar value
  @throws \RuntimeException when trying to remove a value in an array that is in an `ArrayAccess` object
  which cannot retrieve arrays by reference
  
  @return mixed