variable replacement in string



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.
.



Relevant Pages

  • Re: Pascal Server Page
    ... this is a Delphi forum, ... assume everybody here prefers Delphi over other languages, ... but PHP is better suited for web ... PHP supports varaiable interpolation in strings which makes ...
    (borland.public.delphi.non-technical)
  • Re: variable replacement in string
    ... | 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 sprintfand string replace. ...
    (comp.lang.php)
  • Re: variable replacement in string
    ... 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 sprintfand string replace. ... echo; ...
    (comp.lang.php)
  • Re: variable replacement in string
    ... 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 sprintfand string replace. ... echo strtr($template, array( ...
    (comp.lang.php)
  • Ruby equivalent for PHPs strtr?
    ... I'm looking for a function that can do the same thing as the strtr ... function in PHP (and possibly other languages, ... would like to replace multiple parts of a strings simultaneously, ...
    (comp.lang.ruby)