Re: Re: What's faster using if else or arrays?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jim,

I heard of arrays in the following context:
if (($foo==5) || ($foo=="orange") || ($foo==88) ......
So *that* would be done much better and cleaner with arrays.
$FoosArray=array(5, "orange", 88);
if (in_array($foo, $FoosArray)) { ... }

-- 
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: Jim Giner <jim.giner@xxxxxxxxxxxxxxxxxx>
To: php-general@xxxxxxxxxxxxx
Date created: , 12:36:26 AM
Subject:  Re: What's faster using if else or arrays?


      how many entries are you talking about, ie., how many conditions?  Obviously 
if you have more than 4-5 it's going to be easier to code up as a case 
statement (?) rather than an if/else.

Never in all my days have I ever heard of using an array for such a 
determination though.

(remainder deleted for all reader's sakes :) ) 



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



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




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux