RE: [PHP] Variable question
| From: | ..s.c.o.t.t.. [gts] | Date: | Mon, 07 May 2001 20:29:53 +0000 |
| Subject: | RE: [PHP] Variable question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51828@lists.php.net to get a copy of this message | ||
this also works, since you mentioned that you're trying to
get away from evalling an "echo" statement.
$bob = "Roy";
$s = 'Hey there $bob';
$s = '$somevar = "'. $s .'";';
eval ($s);
print $somevar;
prints: "Hey there Roy";
personally, i think that using regexps to implement
an entire symbol parsing engine to do what you ask
is something that you really do not need to do.
instead of trying to reinvent the wheel, use
the free ferarri that PHP provides you :)
> -----Original Message-----
> From: King, Justin [mailto:KingJ@superior.k12.wi.us]
> Sent: Monday, May 07, 2001 4:29 PM
> To: php-general@lists.php.net
> Subject: RE: [PHP] Variable question
>
>
> I'm trying to get around having to do that, I don't know regular
> expressions so it makes it difficult :(
>
> -Justin
>
> -----Original Message-----
> From: "John Vanderbeck" <agathorn@cfl.rr.com>
> Sent: Monday, May 07, 2001 1:21 PM
> To: King, Justin; php-general@lists.php.net
> Subject: RE: [PHP] Variable question
>
> How about manually parsing the string out to give you chunks, that can
> then
> be eval'd easy.
>
> - John Vanderbeck
> - Admin, GameDesign (http://gamedesign.incagold.com/)
> - GameDesign, the industry source for game design and development issues
>
>
> > -----Original Message-----
> > From: King, Justin [mailto:KingJ@superior.k12.wi.us]
> > Sent: Monday, May 07, 2001 4:18 PM
> > To: php-general@lists.php.net
> > Subject: RE: [PHP] Variable question
> >
> >
> > A simple eval($mysqldata) isn't going to do it though since the string
> > is "Your username is $userdata["username"]"; it'll just spit a
> > parse
> > error. I've already tried that
> >
> > -Justin
> >
> > -----Original Message-----
> > From: "Jack Dempsey" <dempsejn@georgetown.edu>
> > Sent: Monday, May 07, 2001 1:13 PM
> > To: King, Justin; php-general@lists.php.net
> > Subject: RE: [PHP] Variable question
> >
> > ok, look into eval()
> >
> > -----Original Message-----
> > From: King, Justin [mailto:KingJ@superior.k12.wi.us]
> > Sent: Monday, May 07, 2001 4:07 PM
> > To: php-general@lists.php.net
> > Subject: RE: [PHP] Variable question
> >
> >
> > Here let me flesh this out a bit more
> >
> > Consider the query "SELECT datafield FROM myTable WHERE id=1";
> >
> > This would return "My username is $userdata["username"]";
> >
> > I want to then output what the database returns, and have php evaluate
> > my variables.
> >
> > -Justin
> >
> >
> > --
> > 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
> >
> >
> >
> > --
> > 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
> >
> >
> > --
> > 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
> >
>
>
> --
> 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
>
>
> --
> 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
>