It seems like you are calling the size function count() as part of the test condition. You might want to compute the size beforehand, and not on each iteration.
If the size of the collection does not change during the iteration, it is
generally a good practice to compute it beforehand, and not on each iteration:
for($i=0;$i<count($array);$i++){// calls count() on each iteration}// Betterfor($i=0,$c=count($array);$i<$c;$i++){// calls count() just once}
Loading history...
21
8
if (preg_match("~^" . $headerParts[0] . "~", $this->headerList[$i]) === 1) {
22
7
$this->headerList[$i] = $header;
23
7
return;
24
}
25
}
26
}
27
28
12
$this->headerList[] = $header;
29
}
30
31
15
public function responseCode($responseCode, $description)
If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration: