есть json:
{"part-1": {"t13": ["https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8ceb0f8.jpg"], "t14": ["https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8cec0b4.jpg"], "t16": ["https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8cee086.jpg", "https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8cee4c9.jpg"], "t19\u201320": ["https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8cf079c.jpg"], "t21\u201322": ["https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8cf2ae5.jpg", "https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8cf2fa0.jpg"]}, "part-2": {"t5": ["https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8d20a76.jpg"], "t6\u20137": ["https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8d219bc.jpg"], "t8": ["https://gdz-ru.com/attachments/images/tasks/000/109/238/0002/5c373b8d25274.jpg"]}}
нужно сделать цикл, который будет выводить:
$obj = json_decode(тут json, который сверху);
<div class="spoiler">
<div class="spoiler-head">* Часть</div>
<div class="spoiler-body extc">
<?php
foreach($obj as $k => $a) {
if ($k[0] !== 't') continue;
foreach($a as $l) {
$res = '<a href="' . $k . '">' . str_replace('t','',$k) . '</a>';
echo $res;
echo '<br>';
}
}
?>
</div>
</div>
подскажите, как его сделать?