-1

I have never used PHP at all so this may be a stupid question.

I am trying to include the year in the copyright notice but want it to update year to year. I read that you can do this with:

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

But when I do this:

<details>
    <summary>&copy; <?php echo date("Y") ?> My Company</summary>
    <p>All rights reserved.</p>
</details>

All I get is:

© My Company

How do I get PHP to display on the page?

P.S. I also tried it with a semicolon as I thought that was the issue, no change:

<?php echo date("Y"); ?>
Machavity
  • 30,841
  • 27
  • 92
  • 100
Steve Medley
  • 213
  • 1
  • 3
  • 16
  • What PHP version do you use? – hemnath mouli Jul 24 '16 at 22:14
  • 1
    The page is `.php`? If you view the source is `` there? – chris85 Jul 24 '16 at 22:16
  • Are you sure that the PHP code is executing? i.e. the page has the appropriate extension, PHP is supported and enabled, etc.? Check whether the page source includes your unexecuted PHP code. If it does, then that's the problem. – LSerni Jul 24 '16 at 22:17
  • are you doing `file:///file.php` or `http://localhost/file.php`? - 2 different animals here. Plus, have you a webserver/PHP installed? – Funk Forty Niner Jul 24 '16 at 22:19

1 Answers1

0

I think you are not executing PHP at all... that PHP code is correct... You may want to use this too if you want other approach:

$fecha = new DateTime('now', new DateTimeZone('America/Argentina/Buenos_Aires'));
$year = $fecha->format('Y');

Where you read America/Argentina/Buenos_Aires change to any location that is available here.

Anyway, I think you PHP code is not running.

If your code only shows everything till the PHP code and then nothing more that is HTML, you could have some PHP error hiding there...

matiaslauriti
  • 7,065
  • 4
  • 31
  • 43