How to use SIMPLE HTML DOM parser to deduce the sequence of the blocks with the same classes?

$html = file_get_html('http://uriya/ru/');

 foreach ($html->find(".programs-page-wrapper") as $elsements) {
 $categories = $elsements;
}
 echo $categories;

The parser outputs only the last element with the class programs-page-wrapper and them some. How to withdraw everything?
June 8th 19 at 16:52
2 answers
June 8th 19 at 16:54
Solution
foreach ($html->find(".programs-page-wrapper") as $elements) {
 $categories = $elements;
 echo $categories;
}

well, or
foreach ($html->find(".programs-page-wrapper") as $elements) {
 $categories[] = $elements;
}
echo implode(", $categories);

or
foreach ($html->find(".programs-page-wrapper") as $elements) {
 $categories .= $elements;
}
echo $categories;
June 8th 19 at 16:56
Do NOT overwrite $categories at each iteration.

there's also foreach and output. or collect it in an array, and then treated

Find more questions by tags PHPParsing