How to Get the Current Year using PHP

  138 views   2 months ago PHP

Use the PHP date() Function

You can simply use the PHP date() function to get the current year.

The following example code will be very useful if you want to put a copyright notice in a website footer without worrying about changing it every year.

<p>Copyright &copy; 
<?php echo date("Y"); ?> 
MyWebsite. All Rights Reserved.</p>

 

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on harsukh21@gmail.com

Related Articles