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

From: Date: Thu, 28 Apr 2011 22:19:38 +0000
Subject: Re: Re: What's faster using if else or arrays?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-312551@lists.php.net to get a copy of this message
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@albanyhandball.com> To: php-general@lists.php.net Date created: , 12:36:26 AM Subject: [PHP] 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

« previous php.general (#312551) next »