Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. AbstractArray.php

function AbstractArray::offsetSet

Sets the given value to the given offset in the array.

@link http://php.net/manual/en/arrayaccess.offsetset.php ArrayAccess::offsetSet()

Parameters

array-key | null $offset The offset to set. If `null`, the value: may be set at a numerically-indexed offset.

T $value The value to set at the given offset.:

3 methods override AbstractArray::offsetSet()
AbstractCollection::offsetSet in vendor/ramsey/collection/src/AbstractCollection.php
AbstractMap::offsetSet in vendor/ramsey/collection/src/Map/AbstractMap.php
@inheritDoc @psalm-suppress MoreSpecificImplementedParamType,DocblockTypeContradiction
Queue::offsetSet in vendor/ramsey/collection/src/Queue.php
Since arbitrary offsets may not be manipulated in a queue, this method serves only to fulfill the `ArrayAccess` interface requirements. It is invoked by other operations when adding values to the queue.

File

vendor/ramsey/collection/src/AbstractArray.php, line 100

Class

AbstractArray
This class provides a basic implementation of `ArrayInterface`, to minimize the effort required to implement this interface.

Namespace

Ramsey\Collection

Code

public function offsetSet(mixed $offset, mixed $value) : void {
    if ($offset === null) {
        $this->data[] = $value;
    }
    else {
        $this->data[$offset] = $value;
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal