Re: how?

From: Date: Fri, 04 May 2001 22:32:50 +0000
Subject: Re: how?
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-51403@lists.php.net to get a copy of this message
Guys! Your solutions are great, and i though of that too! but what prevents what i'm thinking of to be done? Again, ...i have a .TXT file and not a PHP file and inside that .TXT file i have PHP variable names, like $myname, $hisemail .... I want like: $myname = "elias"; $hisemail = "x@x.com" // Read myfile.TXT into $lines, $parsed_lines = $lines; // Sure hoping it get parsed and $myname and other vars get substituted . . . // store $parsed_lines into database Actually, i don't want to Include("myfile.txt") i want to read it via file() and find a solution to parse the nested variable names in it! I even tried: eval("\$parsed_lines = \"$lines\";"); // -> will be evaluated as: $parsed_lines = "hello $myname, $hisemail"; , in turn should get correct values of $myname and $hisemail and replace them into $parsed_lines ... anyway...thanks all. elias. "Geir Eivind Mork" <geir.eivind@mork.as> wrote in message news:01050411160600.03561@maria... > On Thursday 03 May 2001 17:30, Jason Stechschulte wrote: > > On Thu, May 03, 2001 at 03:56:55PM -0700, elias wrote: > > > > i even tried the eval() which should work, but it didn't, scroll down to > > > message with Subject: $hello > > I don't think you understand eval(). Either that or I don't. If I > > understand correctly, eval(); requires a complete PHP statement. > > Welcome $username is not a complete PHP statement. > > that is correct, eval("echo $string"); can be used as a extremly silly way to > echo though. > > > Why don't you just make myfile.txt a valid php file and then include it? > > myfile.txt.php: > > Welcome <?php echo $username;?> > > Enjoy your staying at: <?php echo $site_name;?> > > Mail admin. at <?php echo $admin_mail?> for any questions... > > Now this is as effective as to go to another room for each sip of a glass you > make, why not just: > <? > echo <<<OUT > Welcome $username<br> > Enjoy your staying at: $site_name<br> > Mail admin at $admin_mail for any questions > OUT; > ?> > or at least use <?=$var?> if you want to be mean to the server instead of > wearing out the keyboard. > > -- > php developer / CoreTrek AS | Higgledy Piggledy Coeducational Yale > Sandnes / Rogaland / Norway | University Extracurricular Gave up > web: http://www.moijk.net/ | misogyny Heterosexual > Opened its door. > > -- > 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 (#51403) next »