PHP - 定价表 - 价格是免费的

i have Price tables with monthly and yearly costs but i need a price table there is for free access. If i set the Price to Zero i get an error coz the code cant read the zero price. Below the code snippet. thanks

<?php foreach ($Packages->getDataAs("Package") as $p): ?>
                    <div class="price">
                        <div class="price-content">
                            <div class="main-price">
                                <h1><?= format_price($p->get("monthly_price")) ?></h1>
                                <p><?= htmlchars($Settings->get("data.currency")) ?>/<?= __("per month") ?></p>
                            </div>

                            <p class="special-discount">
                                <?php
                                    $total = 12 * $p->get("monthly_price");
                                    $dif = $total - $p->get("annual_price");
                                    $save = $dif * 100 / $total;

                                    if ($save > 0) {
                                        echo __("Save %s when paid annualy", format_price($dif) . " " . htmlchars($Settings->get("data.currency")));
                                    }
                                ?>
                            </p>

Adding this will solve your problem

$total = 12 * $p->get("monthly_price");
$dif = $total - $p->get("annual_price");
if($total > 0)  //Omits Divide by zero exception
   $save = $dif * 100 / $total;
else
   $save = 0;