1<?php function auto_copyright($year = 'auto'){ ?>
2 <?php if(intval($year) == 'auto'){ $year = date('Y'); } ?>
3 <?php if(intval($year) == date('Y')){ echo intval($year); } ?>
4 <?php if(intval($year) < date('Y')){ echo intval($year) . ' - ' . date('Y'); } ?>
5 <?php if(intval($year) > date('Y')){ echo date('Y'); } ?>
6<?php } ?>
7
8<?php auto_copyright(); // 2011?>
9
10<?php auto_copyright("2010"); // 2010 - 2017 ?>