How to Get the Current Year using PHP?

You can easily get current year and time using PHP built-in date() function.

<?php  
// Get current year in PHP
$current_year = date("Y");
echo $current_year;
?> 

This most common use of displaying the current year (dynamically) is inside the copyright message. For example, you must have seen in website footer: Copyright 2020 – Website brand-name.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.