Mmmm un ejemplo:
Código PHP:
class myCustomStorage extends SplObjectStorage {
public function clear() {
while( $item = $this->current() ) {
$this->detach( $item );
$item = $this->next();
}
if( count( $this ) > 0 ) {
$this->detach( $this->current() );
}
}
}
Saludos.