Method atomic_get_set()
- Method
atomic_get_set
mixed
atomic_get_set(mapping
|object
map
,mixed
key
,mixed
val
)
mixed
atomic_get_set(array
arr
,int
index
,mixed
val
)- Description
Replace atomically the value for a key in a mapping or array.
- Parameter
map
- Parameter
arr
Mapping or array to alter.
- Parameter
key
- Parameter
index
Key or index to change the value for.
- Parameter
val
Value to change to. If value is UNDEFINED and
map
is a mapping this function function behaves exactly asm_delete(map, key)
.- Returns
Returns the previous value for
key
. Ifmap
is a mapping and there was no previous value UNDEFINED is returned.If
map
is an objectlfun::_m_replace()
will be called in it.- See also