Re: What's faster using if else or arrays?
| From: | dholmes1031 at gmail dot com | Date: | Thu, 28 Apr 2011 22:37:53 +0000 |
| Subject: | Re: What's faster using if else or arrays? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-312552@lists.php.net to get a copy of this message | ||
Thanks switch and case seems to be more faster for the job and a lot cleaner
------Original Message------
From: Andre Polykanine
To: dholmes1031@gmail.com
Cc: php-general@lists.php.net
Subject: Re: [PHP] What's faster using if else or arrays?
Sent: Apr 28, 2011 6:17 PM
Hello Dholmes1031,
I would write it like this:
switch($foo) {
case 5: $dothis; break;
case 3: $dothat; break;
default: $donothing; break;
}
--
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion
------------ Original message ------------
From: dholmes1031@gmail.com <dholmes1031@gmail.com>
To: php-general@lists.php.net
Date created: , 12:30:31 AM
Subject: [PHP] What's faster using if else or arrays?
I'm working on a project and I was wondering if I should use if else's or arrays ??
Example
If($foo= 5)
{
$dothis
}
ElseIf($foo= 3)
{
$dothis
}
Else{ $donothing }
Or put it in some short of arrays and pregmatch what would be the best to use and easiest to read
Sent via BlackBerry from T-Mobile
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Sent via BlackBerry from T-Mobile