표준 PHP 라이브러리(SPL) SplObjectStorage::removeAll
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
SplObjectStorage::removeAll — 현재 저장소에서 다른 저장소에 포함된 개체를 제거합니다.
설명
public SplObjectStorage::removeAll(SplObjectStorage $storage
): int
현재 저장소에서 다른 저장소에 포함된 개체를 제거합니다.
매개변수
storage
- 제거할 요소가 포함된 저장소입니다.
반환 값
남은 객체의 수를 반환합니다.
Examples
예제 #1 SplObjectStorage::removeAll() 예제
<?php
$o1 = new StdClass;
$o2 = new StdClass;
$a = new SplObjectStorage();
$a[$o1] = "foo";
$b = new SplObjectStorage();
$b[$o1] = "bar";
$b[$o2] = "gee";
var_dump(count($b));
$b->removeAll($a);
var_dump(count($b));
?>
위의 예는 다음과 유사한 결과를 출력합니다.
int(2) int(1)
기타
- SplObjectStorage::addAll() - 다른 저장소의 모든 개체를 추가합니다.