I have read everything I could find on switching from ereg (deprecated) to preg_match. My attempts to solve it by adding delimiters and escape expressions (which may not be necessary) have been in vain. I started with:
$file = fopen(VARS_FILE,"r");
while(!feof($file)) {
$line = fgets($file,1000);
$parts = explode(':',$line);
if(ereg("breaks",$parts[0]) || ereg("high_",$parts[0]))
$GLOBALS[$parts[0]] = explode(',',trim($parts[1]));
else
$GLOBALS[$parts[0]] = trim($parts[1]);
}
fclose($file);
and tried to change it to:
$file = fopen(VARS_FILE,"r");
while(!feof($file)) {
$line = fgets($file,1000);
$parts = explode(':',$line);
if(preg_match("/breaks/",$parts[0]) || preg_match("/high_/",$parts[0]))
$GLOBALS[$parts[0]] = explode(',',trim($parts[1]));
else
$GLOBALS[$parts[0]] = trim($parts[1]);
}
fclose($file);
This continues resulting in errors like
"fgets() expects parameter 1 to be resource, boolean given in..."
Any advice appreciated.