function MapInterface::putIfAbsent
Associates the specified value with the specified key in this map only if it is not already set.
If there is already a value associated with `$key`, this returns that value without replacing it.
Parameters
K $key The key to put in the map.:
T $value The value to store at `$key`.:
Return value
T | null the previous value associated with key, or `null` if there was no mapping for `$key`.
1 method overrides MapInterface::putIfAbsent()
- AbstractMap::putIfAbsent in vendor/
ramsey/ collection/ src/ Map/ AbstractMap.php
File
-
vendor/
ramsey/ collection/ src/ Map/ MapInterface.php, line 92
Class
- MapInterface
- An object that maps keys to values.
Namespace
Ramsey\Collection\MapCode
public function putIfAbsent(int|string $key, mixed $value) : mixed;