php year code code example
Example 1: get current year php
<?php echo date("Y"); ?>
Example 2: automatic years php
© <?php echo date("Y"); ?>
Example 3: php get current year
$currentYear=date("Y");
Example 4: automatic years php
<?php function auto_copyright($year = 'auto'){ ?>
<?php if(intval($year) == 'auto'){ $year = date('Y'); } ?>
<?php if(intval($year) == date('Y')){ echo intval($year); } ?>
<?php if(intval($year) < date('Y')){ echo intval($year) . ' - ' . date('Y'); } ?>
<?php if(intval($year) > date('Y')){ echo date('Y'); } ?>
<?php } ?>
<?php auto_copyright(); ?>
<?php auto_copyright("2010"); ?>