Re: New function request - Variable parsing a string
| From: | Daniel C. | Date: | Thu, 02 Sep 2004 16:55:32 +0000 |
| Subject: | Re: New function request - Variable parsing a string | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-12547@lists.php.net to get a copy of this message | ||
While this would definitely be handy, it seems (to me, and I am not by
any means an expert on these things,) that it would make more sense to
add this to a string-munging library instead of integrating it into
the PHP language itself.
Dan
On Wed, 1 Sep 2004 08:22:14 -0700, Sara Golemon <pollita@php.net> wrote:
> He wants to store an UNinterpolated string somewhere (like a DB or text
> file), then interpolate it at run-time.
>
> $sitename = 'php.net';
> $username = 'pollita';
> $string = $db->getOne('SELECT somestring FROM thetable WHERE
> id=\'foo\'');
> /* $string now contains something like: 'Welcome to {$sitename}. You are
> logged in as {$username}'
> * He wants $string to get interpolated into: 'Welcome to php.net. You are
> logged in as pollita'
> */
>
> I've thought this would be a nice thing to have as well, but it's not
> something that can be trivially ripped out of the compiler and I havn't
> personally had the motivation to actually get it done.
>
> -Sara