setObjectValue.php
Table of Contents
Functions
- setObjectValue() : object
- Sets a value in a flat object using a single property name.
Functions
setObjectValue()
Sets a value in a flat object using a single property name.
setObjectValue(object $document, string $key, mixed $value) : object
This helper function assigns the given value to the specified property of the provided object. It does not support nested paths or separators.
The object is returned with the updated property.
Parameters
- $document : object
-
The object to modify.
- $key : string
-
The property name to set.
- $value : mixed
-
The value to assign to the property.
Tags
Return values
object —The modified object with the new or updated property.