Can someone please help me convert this script to make it compatible with php7?
I’ve tried using preg_replace, but I keep getting an error about delimiters.
function replaceTag($str, $tag, $value)
{
if ($value == " ") {
$str = ereg_replace(strtolower($tag), $value, $str);
$str = ereg_replace(strtoupper($tag), $value, $str);
}
$str = ereg_replace(strtolower($tag) . '([^=]*)=([^"]*)"([^"]*)"', $value, $str);
$str = ereg_replace(strtoupper($tag) . '([^=]*)=([^"]*)"([^"]*)"', $value, $str);
$str = ereg_replace(strtolower($tag) . "([^=]*)=([^']*)'([^']*)'", $value, $str);
$str = ereg_replace(strtoupper($tag) . "([^=]*)=([^']*)'([^']*)'", $value, $str);
return $str;
}