
SplObjectStorage::removeAll 메서드는 모든 객체를 제거할 수 있습니다.
#hostingforum.kr
php
$storage = new SplObjectStorage();
$storage->attach(new stdClass());
$storage->attach(new stdClass());
$storage->removeAll();
var_dump($storage->count()); // 0
객체가 남아있는지 확인하기 위해서는 $storage->count() 메서드를 사용할 수 있습니다. removeAll 메서드를 사용한 후에도 객체가 남아있다면 count 메서드는 0이 아닌 값을 반환합니다.
#hostingforum.kr
php
$storage = new SplObjectStorage();
$storage->attach(new stdClass());
$storage->attach(new stdClass());
$storage->removeAll();
var_dump($storage->count()); // 0
2025-08-02 03:04