You could use the $key => $value
syntax to get both the key and the value with foreach
:
foreach($result as $key => $elem) {
echo(
'
<div class="col-sm-3 pt-2">
<div class="card">
<div class="card-body">
<h5 class="card-title">'.$key.' </h5>
<p class="card-text">With supporting text below as a natural lead-in to additional content.</p>
<a href="" class="btn btn-primary float-right">Open</a>
</div>
</div>
</div>
'
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…