The SplObjectStorage::offsetSet() function is an inbuilt function in PHP which is used to set the object of storage.
void SplObjectStorage::offsetSet($obj, $val)
Parameters: This function accept two parameters as mention above and described below:
- $obj: It specifies the object to be attach.
- $val: It specifies the value to be associate with the object.
Return Value: This function does not return any value.
Below programs illustrate the SplObjectStorage::offsetSet() function in PHP:
string(12) "GeksforGeeks" string(3) "GFG" string(9) "Hello GFG" NULL
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.