Something I've always been meaning to ask.
If going thro a large amount of data, does it matter whether I compare the 
value to the array item, or visa-versa?

$colr = array('red', 'blue', 'green', etc);
example 1
foreach($colr as $item) {
  if ($item == 'blue')
  // Do something
}
example 2
foreach($colr as $item) {
  if ('blue' == $item)
  // Do something
}

Obviously, example 1 is more readable. But I seem to remember reading that one 
is more beneficial, but dismissed it at the time.
Thanks, Bob.



------------------------------------

Please remember to write your response BELOW the previous text. 

Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-listYahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-list/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to