Re: ereg works in .php, not in .inc

From: Date: Sat, 13 Jan 2001 23:51:48 +0000
Subject: Re: ereg works in .php, not in .inc
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-34419@lists.php.net to get a copy of this message
Do you have <?php and ?> in your .inc file?... ----- Original Message ----- From: Ted Goranson <tedg@sirius-beta.com> Newsgroups: php.general Sent: Saturday, January 13, 2001 12:35 AM Subject: [PHP] ereg works in .php, not in .inc > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#34419) next »