Permalink
Browse files

Change while with foreach as is faster

  • Loading branch information...
1 parent d7d15ab commit 0edfe24f5087634d903cbd613121be9347da8031 @acidvertigo acidvertigo committed May 25, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 catalog/includes/classes/http_client.php
@@ -101,7 +101,7 @@ function setCredentials($username, $password) {
function setHeaders($headers) {
if (is_array($headers)) {
reset($headers);
- while (list($name, $value) = each($headers)) {
+ foreach($headers as $name => $value) {
$this->requestHeaders[$name] = $value;
}
}
@@ -203,7 +203,7 @@ function Post($uri, $query_params = '') {
if (is_array($query_params)) {
$postArray = array();
reset($query_params);
- while (list($k, $v) = each($query_params)) {
+ foreach($query_params as $k => $v) {
$postArray[] = urlencode($k) . '=' . urlencode($v);
}
@@ -339,7 +339,8 @@ function sendCommand($command) {
$cmd = $command . "\r\n";
if (is_array($this->requestHeaders)) {
reset($this->requestHeaders);
- while (list($k, $v) = each($this->requestHeaders)) {
+
+ foreach($this->requestHeaders as $k => $v) {
$cmd .= $k . ': ' . $v . "\r\n";
}
}

0 comments on commit 0edfe24

Please sign in to comment.