只打印出某个值PHP末尾有“a”的结果集?

I have a foreach loop that iterates over objects in an array. Currently, it outputs information for every element. I need to print out data for only the objects that have an "a" at the end of their id property. Code is as follows:

foreach ($obj as $key => $value) {
    echo '<tr id="subRow">';
    echo '<td>' . $value->date . '</td>';
    echo '<td class="leftLine">' . $value->Name . '</td>';
    echo '<td class="leftLine">' . $value->dealType . '</td>';
    echo '<td class="leftLine">' . $value->id . '</td>';
    echo '<td class="leftLine">' . 'Adobe PDF' . '</td>';
    echo '</tr>';
}

So for every element of the $obj that contains an ID number with an "a" at the end of it, print out that entire element.

substr can help with that:

foreach ($obj as $key => $value) {
    if(substr($value->id, -1) === 'a') {
        echo '<tr id="subRow">';
        echo '<td>' . $value->date . '</td>';
        echo '<td class="leftLine">' . $value->Name . '</td>';
        echo '<td class="leftLine">' . $value->dealType . '</td>';
        echo '<td class="leftLine">' . $value->id . '</td>';
        echo '<td class="leftLine">' . 'Adobe PDF' . '</td>';
        echo '</tr>';
    }
}