How to Get the Current Year using PHP

902 views 1 year 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 © 
<?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 [email protected]