Why we use ArrayAccess::offsetUnset() instead i hope unset() is enough to use. But php.net stated that:
Note: This method will not be called when type-casting to (unset)
Can anyone tell how we use it, whether it automatically unset the called offset element from the class that implements ArrayAccess interface ?
Reference link http://php.net/manual/en/arrayaccess.offsetunset.php.
Thanks !!!
The
offsetUnset()
method is called, when the array access expression is used in theunset()
function like this:However it is not called in the following statements: