You are here: Re: [PHP] What is faster? « PHP « IT news, forums, messages
Re: [PHP] What is faster?

Posted by "Mark Cain" on 06/05/05 20:10

I checked the first expression with 1,000 iterations and it took 0.00745
seconds.

Here is the code I used. You can use it find the time for the second
expression and any future "which is faster" queries you might have. This
way you can create you own documentation.


<?
$start1 = vsprintf('%d.%06d', gettimeofday());


for($i=1;$i<=1000;$i++){
if(!(is_null($customMenu)) && (is_array($customMenu))) {
$menu=$customMenu;
} else {
$menu=array('Documentation','Settings');
};
}

$end1 = vsprintf('%d.%06d', gettimeofday());

$lapse1 = bcsub($end1,$start1,7);

echo "Start Time: " . $start1 . "<BR>" . "End Time: " . $end1 . "<P>" .
$lapse1;
?>




Mark Cain


----- Original Message -----
From: "Andy Pieters" <mailings@vlaamse-kern.com>
To: <php-general@lists.php.net>
Sent: Sunday, June 05, 2005 12:24 PM
Subject: [PHP] What is faster?


> Hi all
>
> Of these two expressions, which one is faster?
>
> if(!(is_null($customMenu)) && (is_array($customMenu)))
> $menu=$customMenu;
> else
> $menu=array('Documentation','Settings');
>
>
> OR
>
> $menu=(!(is_null($customMenu)) &&
(is_array($customMenu))?$customMenu:$menu);
>
> Anybody have any documentation on this?
>
>
> Kind regards
>
>
> Andy
>
> --
> Registered Linux User Number 379093
> -- --BEGIN GEEK CODE BLOCK-----
> Version: 3.1
> GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>++++$ P-(+)>++
> L+++>++++$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
> PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
> e>++++$@ h++(*) r-->++ y--()>++++
> -- ---END GEEK CODE BLOCK------
> --
> Check out these few php utilities that I released
> under the GPL2 and that are meant for use with a
> php cli binary:
>
> http://www.vlaamse-kern.com/sas/
> --
>
> --
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

 

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

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