Skip to content

Commit

Permalink
Change while with foreach for performance.
Browse files Browse the repository at this point in the history
  • Loading branch information
acidvertigo committed May 25, 2011
1 parent 0edfe24 commit 351993c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion catalog/includes/classes/language.php
Expand Up @@ -83,7 +83,7 @@ function get_browser_language() {


for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) { for ($i=0, $n=sizeof($this->browser_languages); $i<$n; $i++) {
reset($this->languages); reset($this->languages);
while (list($key, $value) = each($this->languages)) { foreach($this->languages as $key => $value) {
if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) { if (preg_match('/^(' . $value . ')(;q=[0-9]\\.[0-9])?$/i', $this->browser_languages[$i]) && isset($this->catalog_languages[$key])) {
$this->language = $this->catalog_languages[$key]; $this->language = $this->catalog_languages[$key];
break 2; break 2;
Expand Down

0 comments on commit 351993c

Please sign in to comment.