How to get current year in PHP?

How do I get the current year using PHP? I want to update the footer copyright year automatically. This is not a good idea to put a fixed year on the website.

If you are looking for the copyright year in the footer. You can do it in both PHP and JavaScript.


<?php echo date("Y"); ?>


{{ now()->year }}
// Or
{{ date("Y") }}


<script>document.write(new Date().getFullYear())</script>