Solving
Reply to discussion (solution)
$a = Array (1,2,2,3,1,2,3,1,1), $st = Array (1 = 0), $d = 1;foreach ($a as $v) { @ $st [$v]++; if ($v >= $d) { $d = $v; } else{ while ($v < $d) { unset ($st [$d--]); } }
Array
(
[0] = 1
[1] = 1.1
[2] = 1.2
[3] = 1.2.1
[4] = 2
[5] = 2.1
[6] = 2.1.1
[7] = 3
[8] = 4
)
Sorry, I didn't see what it meant. ......。。 ...。 ............。 ......。。 ...。 ......。。 ...。 ......。 ......。 .........
$a = Array (1,2,2,3,1,2,3,1,1), $st = Array (1 = 0), $d = 1;foreach ($a as $v) { @ $st [$v]++; if ($v >= $d) { $d = $v; } else{ while ($v < $d) { unset ($st [$d--]); } }
Array
(
[0] = 1
[1] = 1.1
[2] = 1.2
[3] = 1.2.1
[4] = 2
[5] = 2.1
[6] = 2.1.1
[7] = 3
[8] = 4
)
Moderator, thank you for your answer, if so, can you talk about your ideas ah, thank you very much
Sorry, I didn't see what it meant. ......。。 ...。 ............。 ......。。 ...。 ......。。 ...。 ......。 ......。 .........
The topic is actually a directory layout problem, you can see that the priority determines the size of the title of the display
$a = array (1,2,2,3,1,2,3,1,1); Represents the level at which the node is located
$st = Array (1 = 0); Stores the current ordinal number of each layer
$d represents the current level
Well, thanks to the moderator's explanation, I'll do a good research, first to distribute the