How to put the numbering of elements in php without html?

Hi all. Tell me, please, is there in php a possibility of setting of the numbering. Maybe without using the tags ol and Li. Or cyclically. And then I have the table and the validator complains much.
I need to get a structure like this
and so on
$previousLevel = 0;
foreach($arResult["SECTIONS"] as $arSection):?>

 <?if ($arSection["DEPTH_LEVEL"] == 1):?> 
 the <div><?=$arSection["NAME"]?><</div> //Elements 1. (2. 3. and so on. first level)
 <h3><?=$arSection['NAME']?></h3>//elements 1.1. (2.1 and so on second level)
 <?if (!empty($arSection["ITEMS"])):?> //table of elements of type 1.1.1 (2.1.1 and so on. third level)
 <table class="table">
 <tbody class="hideseek">
 <?foreach($arSection["ITEMS"] as $arItem):?>
 <tr id="<?=$this->GetEditAreaId($arItem['ID']);?>">
<td><?=$arItem["DISPLAY_PROPERTIES"]["PRICE"]["a display_value"]?></td>
 <?$previousLevel = $arSection["DEPTH_LEVEL"];?>
June 27th 19 at 15:34
1 answer
June 27th 19 at 15:36
$i = 1;
foreach($arResult["SECTIONS"] as $arSection):?>
 echo $i;
 $k = 1;
 <?foreach($arSection["ITEMS"] as $arItem):?>
 echo $i . '.' . $k;
 <?php endforeach; ?>
<?php endforeach; ?>

Find more questions by tags PHP