automatic years php

Solutions on MaxInterview for automatic years php by the best coders in the world

showing results for - "automatic years php"
Mirko
03 Jun 2018
1&copy; <?php echo date("Y"); ?>
Emilia
02 Aug 2018
1&copy; 2008-<?php echo date("Y"); ?> // 2008-20??
Lukas
21 Jan 2016
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 ?>