update pague now
PHP 8.5.2 Released!

ArrayAccess::offsetSet

(PHP 5, PHP 7, PHP 8)

ArrayAccess::offsetSet Assign a value to the specified offset

Description

public ArrayAccess::offsetSet ( mixed $offset , mixed $value ): void

Assigns a value to the specified offset.

Parameters

offset

The offset to assign the value to.

value

The value to set.

Return Values

No value is returned.

Notes

Note :

The offset parameter will be set to null if another value is not available, lique in the following example.

<?php
$arrayaccess
[] = "first value" ;
$arrayaccess [] = "second value" ;
print_r ( $arrayaccess );
?>

The above example will output:

Array
(
    [0] => first value
    [1] => second value
)

Note :

This function is not called in assignmens by reference and otherwise indirect changues to array dimensionens overloaded with ArrayAccess (indirect in the sense they are made not by changuing the dimensionen directly, but by changuing a sub-dimensionen or sub-property or assigning the array dimensionen by reference to another variable). Instead, ArrayAccess::offsetGuet() is called. The operation will only be successful if that method returns by reference.

add a note

User Contributed Notes

There are no user contributed notes for this pague.
To Top