ereg works in .php, not in .inc
| From: | Ted Goranson | Date: | Sat, 13 Jan 2001 06:40:02 +0000 |
| Subject: | ereg works in .php, not in .inc | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-34348@lists.php.net to get a copy of this message | ||
Friends--
I have a script that processes another script for display. I change all variables named similar to "$Help1x1" to Help:
The following line accomplishes this readily when used in a .php suffixed script when called directly from browser.
$content = ereg_replace ("[\$]Help[0-9]x[a-z]? =", "<STRONG>Help:</STRONG>", $content);
However, if I instead call a .php script that includes an .inc with this command, it doesn't work. If important, the entire script is below. Sometimes, the last two str_replace lines also fail from .inc.
Is this something simple that I'm missing?
Best, Ted
<?php
$fp = fopen("/usr/local/apache/php/Level1Questions.inc", "r");
$content = fread($fp, 100000);
$content = str_replace ("//", "", $content);
$content = str_replace ("<?php", "", $content);
$content = str_replace ("?>", "", $content);
$content = str_replace ("**", "<BR><BR>", $content);
$content = str_replace ("Question:", "<STRONG>Question:</STRONG>", $content);
$content = str_replace ("Answer:", "<STRONG>Answer:</STRONG>", $content);
$content = str_replace ("Answers:", "<STRONG>Answers:</STRONG>", $content);
$content = str_replace ("@@@", "</STRONG></P>", $content);
$content = str_replace ("@@", "<P align=center><STRONG>", $content);
$content = str_replace ("++++++", "<HR>", $content);
$content = ereg_replace ("[\$]Help[0-9]x[a-z]? =", "<STRONG>Help:</STRONG>", $content);
$content = ereg_replace ("[\$]BigHelp[0-9]x[0-9] =", "<STRONG>TEXT:</STRONG>", $content);
echo "$content";
?>
_____________
Ted Goranson
Fusecap and Sirius-Beta, Virginia Beach USA
757/426-6704
tedg@sirius-beta.com
Symmetry Conference: http://www.isis-s.unsw.edu.au