Open In App

PHP SplObjectStorage detach() Function

Last Updated : 23 Jun, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report
The SplObjectStorage::detach() function is an inbuilt function in PHP which is used to remove objects from the storage. Syntax:
void SplObjectStorage::detach($obj)
Parameters: This function accepts a single parameter $obj which specifies the object to be remove from the storage. Return Value: This function does not return any value. Below programs illustrate the SplObjectStorage::detach() function in PHP: Program 1:
Output:
int(1)
int(0)
Program 2:
Output:
int(3)
int(2)
int(1)
Reference: https://www.php.net/manual/en/splobjectstorage.detach.php

Next Article

Similar Reads