On Saturday, April 30, 2011, Simon J Welsh wrote:

> I would use something simple like:
> if(date('Y') == '2011') {
>         echo '2011';
> } else {
>         echo '2011-', date('Y');
> }

... or in one line:

echo (date('Y') != '2011' ? '2011-' : '') . date('Y');

However, you might want to change that to:

echo '2011-' . date('Y');

at the first review after the start of 2012!

HTH,

-- 
Geoff


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to