Reputation: 9
I have this code in my footer of my website:
<style>
@media only screen and (min-width:801px) {
footer .widget { width: <?php echo (102-2*$cnt)/$cnt; ?>%; }
#<?php echo $total_widgets['smt_footer_sidebar'][$cnt-1]; ?> { margin-right:0; }
}
</style>
I get a PHP Warning Division by zero error in my errorlog.
It's in line:
footer .widget { width: <?php echo (102-2*$cnt)/$cnt; ?>%; }
Can someone help me, please.
Upvotes: 0
Views: 72
Reputation: 4599
Replace
<?php echo (102-2*$cnt)/$cnt; ?>
with
<?= $cnt != 0 ? (102-2*$cnt)/$cnt : 0 ; ?> <-- condition ? true : false
or 100
instead of 0
at false
position, it's up to you
Upvotes: 4