Francois M
Francois M

Reputation: 62

Use date() variable

I want to echo my var.

For example:

<?php
  echo $MONTH09;  // Return September
?>

I need to bulid it like this:

<?php
  echo $$."MONTH".date('m');
?>

But it does not work.

thanks for your help.

Upvotes: 0

Views: 66

Answers (1)

hsz
hsz

Reputation: 152216

Try with:

echo ${'MONTH' . date('m')};

But better way to print month is:

echo date('F');

Upvotes: 2

Related Questions