Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

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(); // 2011?>

<?php auto_copyright("2010");  // 2010 - 2017 ?>
 
PREVIOUS NEXT
Tagged: #automatic #years #php
ADD COMMENT
Topic
Name
6+8 =