0

what is the diffrenece between Detach() and offsetUnset() in SPLObjecStorage. Looks like they do same thing. if so why there is two method for same job?

varuog
  • 3,031
  • 5
  • 28
  • 56
  • 1
    `offsetUnset()` is an alias of `detach()`. `detach()` is the canonical method to use, but `offsetUnset()` is there as part of the `ArrayAccess` interface implementation to allow `unset($storage[$offset])`. – salathe Mar 02 '13 at 21:19
  • @salathe That explains well – varuog Mar 02 '13 at 21:36

1 Answers1

0

There is absolutely no difference, one is an alias for the other:

Note:

SplObjectStorage::offsetUnset() is an alias of SplObjectStorage::detach().

Jon
  • 428,835
  • 81
  • 738
  • 806