Hi - This snippet works OK for me in PHP4, using str_replace instead of eregi, but you may have good reasons for going with eregi.
$header= "<?php echo(\$ForumName); ?> remainder of line";
$header = str_replace("<?php echo(\$ForumName); ?>","[[ForumName]]",$header);
echo htmlentities($header),"<br>";
$header = str_replace("[[ForumName]]","<?php echo(\$ForumName); ?>",$header);
echo htmlentities($header),"<br>";
I'm only using the 'htmlentities' function to get the variable to show up rather than the browser ignoring it in the php tags.