|
Posted by NC on 04/23/07 15:44
On Apr 23, 7:39 am, "Rolf Mander" <rolf.man...@spam.com> wrote:
> What performs better, theoreticaly?
>
> echo date("d",time());
> echo date("m",time());
> echo date("Y",time());
>
> Or that?
>
> $time = time();
> echo date("d",$time);
> echo date("m",$time);
> echo date("Y",$time);
Theoretically (and assuming that your question is more general than
the example you gave), it depends on what system resource is
constrained. If it is memory, the first would work better (there is
no additional variable required); if it is CPU, the second is better
(one function call instead of three).
> when does it get relevant?
Very rarely, unless you are building something quantitative. The
resource that usually gets constained first is disk I/O.
Cheers,
NC
[Back to original message]
|