You are here: Re: What performs better, theoreticaly? « PHP Programming Language « IT news, forums, messages
Re: What performs better, theoreticaly?

Posted by Toby A Inkster on 04/23/07 15:22

Rolf Mander wrote:

> <?
> echo date("d",time());
> echo date("m",time());
> echo date("Y",time());
> ?>

Consider running this code at the stroke of midnight on Monday/Tuesday
next week.

<?
/* Today is Monday 30 April 2007 */
echo date("d",time());
/* It's midnight now. Clocks go 23:59:59 => 00:00:00. */
/* Today is Tuesday 1 May 2007 */
echo date("m",time());
echo date("Y",time());
?>

Outputs: 30052007

The other code you posted:

> <?
> $time = time();
> echo date("d",$time);
> echo date("m",$time);
> echo date("Y",$time);
> ?>

Doesn't suffer from that problem. It's also probably faster, but unless
you're doing it thousands of times in a loop, you won't notice any
difference.

--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация