[lang-ref] ( clear_without_reassigning ) ( php )

<?php
public function testClearWithoutReassigningAlternative(): void
{
	// foreach { .. unset }
	$items = ['A', 'B', 'C', 'D', 'E'];

	foreach ($items as $key => $value) {
		unset($items[$key]);
	}

	$this->assertSame([], $items);
}