What are some best practices for dynamically assigning CSS classes to numbers in PHP for typographic adjustments?

When dynamically assigning CSS classes to numbers in PHP for typographic adjustments, a common best practice is to use conditional statements to determine the appropriate CSS class based on the value of the number. This allows for targeted styling based on the specific range or value of the number.

<?php
$number = 15;

if ($number < 10) {
    $class = 'small-number';
} elseif ($number >= 10 && $number <= 20) {
    $class = 'medium-number';
} else {
    $class = 'large-number';
}

echo '<span class="' . $class . '">' . $number . '</span>';
?>