I have been upgrading some scripts to use recent coding but this one is getting to me. I have done some switching over to use the preg but this bit of code seems to be fighting back,
Heres the portion of code I need to replace, its part of code used for polling
function pre_parse($filename) {
if (isset($this->pre_output[$filename]) && !empty($this->pre_output[$filename])) {
return $this->pre_output[$filename];
}
if (isset($this->vars[$filename])) {
reset($this->vars[$filename]);
$this->pre_output[$filename] = ereg_replace("\"", "\\\"", $this->files[$filename]);
while(list($name, $value) = each($this->vars[$filename])) {
$value = ereg_replace("\"", "\\\"", $value);
$this->pre_output[$filename] = str_replace($this->start.$name.$this->end, $value, $this->pre_output[$filename]);
}
} else {
$this->pre_output[$filename] = ereg_replace("\"", "\\\"", $this->files[$filename]);
}
return $this->pre_output[$filename];
}
Can someone please help with a conversion here, its leading to more issues with headers and its been holding me up trying to nail this one to get it just right... I wish they let us run legacy scripts option but my server dont!
I can pm you a lin if your willing to take this on for me, im sick of seeing header errors they always were a headache for me when i wrote these scripts a few years back my coding was marginal and just barely tolerant tp php but now its making me fix these little errors and the preg call is one thats beating me up
I know this was a widely covered topic, I looked at a few dozen but everytime I tried the conversion it failed, i think because of they way the paths are defined, i tried to rethink the code but it only got worse,
Anyone?