Re: variable replacement in string [message #178010 is a reply to message #178002] |
Thu, 10 May 2012 14:04   |
Jeff North
Messages: 58 Registered: November 2010
Karma:
|
Member |
|
|
On Thu, 10 May 2012 14:44:08 +0200, in comp.lang.php "M. Strobel"
<sorry_no_mail_here(at)nowhere(dot)dee>
<a11rgoFph0U1(at)mid(dot)uni-berlin(dot)de> wrote:
> | Hi,
> |
> | I am still searching a function in PHP to execute variable replacement in strings.
> | Other languages do have this, but for PHP I can only find sprintf() and string replace.
> |
> | I have
> |
> | $t = ' - solved - ';
> | $msg = 'The problem is $t';
> |
> | I want now:
> |
> | echo fxx($msg);
> |
> | print out "The problem is - solved - ".
> |
> | Please don't tell me about $msg = "The problem is $t"; just think of $msg like a
> | template read from a file.
> |
> | /Str.
How about:
$msg = 'The problem is {$t}';
|
|
|