[lang-ref] ( array_foreach_with_index ) ( php )
<?php
public function testArrayForeachWithIndex(): void
{
// foreach ($items as $index => $item)
$items = ['A', 'B', 'C', 'D', 'E'];
$r = '';
foreach ($items as $index => $item) {
$r .= "$index$item;";
}
$this->assertSame('0A;1B;2C;3D;4E;', $r);
}