Zend certified PHP/Magento developer

if condition in Magento for email template

I need help to verify my if statement, I am not sure in Magento of using "$block->escapeHtml($label)" in if condition is correct or not

does my if statement correct for only showing “Card Number” & “Card Type” info?

thanks!

<?php if ($block->escapeHtml($label) == 'Card Number') || ( $block->escapeHtml($label) == 'Card Type') {?>

/module-payment/view/frontend/templates/info/default.phtml

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

/**
 * @var MagentoPaymentBlockInfo $block
 * @see MagentoPaymentBlockInfo
 */
$specificInfo = $block->getSpecificInformation();
$title = $block->escapeHtml($block->getMethod()->getTitle());
?>
<dl class="payment-method">
    <dt class="title"><?= /* @noEscape */ $title ?></dt>
<?php if ($specificInfo) : ?>
    <dd class="content">
        <table class="data table">
            <caption class="table-caption"><?= /* @noEscape */ $title ?></caption>
            <?php foreach ($specificInfo as $label => $value) : ?>
                <?php if ($block->escapeHtml($label) == 'Card Number') || ( $block->escapeHtml($label) == 'Card Type') {?>
                <tr>
                    <th scope="row"><?= $block->escapeHtml($label) ?></th>
                    <td>
                        <?= /* @noEscape */ nl2br($block->escapeHtml(implode("n", $block->getValueAsArray($value, true)))) ?>
                    </td>
                </tr>
                <?php } ?>
            <?php endforeach; ?>
        </table>
    </dd>
<?php endif;?>
</dl>
<?= $block->getChildHtml() ?>