Hi, I have the following code whcich works, but consumes too much memory. In order to reduce memory, I want to change the "foreach" statement to a "for" statement, but I do not knwohow. Any ideas? If not, any other waus to reduce memory uptake?
The array is $web
foreach ($web as $key => $val)
{
$data = file_get_contents("$val");
preg_match("@Code\=(.*?)\</p\>@", $data, $outcode);
$code = preg_replace("@\<(.*?)\>@", "", $outcode[1]);
preg_match("@Class\:(.*?)\<br\s/\>@", $data, $outclass);
$class = preg_replace("@\<(.*?)\>@", "", $outclass[1]);
preg_match("@http\://(.*?)\"\>@", $data, $outid);
$id = $outid[1];
$web[$key] = $code."|".$id."|".$class."|".$val."\r\n";
}