PHP 8.5.0 Alpha 4 available for testing

Voting

: five minus five?
(Example: nine)

The Note You're Voting On

Hayley Watson
7 years ago
No complaints from SplObjectStorage if you try to detach an object that isn't in the collection; it's a no-op.

<?php

$o
= new StdClass;
$t = new StdClass;
$s = new SplObjectStorage();
$s->attach($o);
var_dump(count($s));
$s->detach($t); // Didn't attach this one.
var_dump(count($s));

?>

<< Back to user notes page

To Top