Re: variable replacement in string
- From: The Natural Philosopher <tnp@xxxxxxxxxxxxxxx>
- Date: Thu, 10 May 2012 14:00:11 +0100
M. Strobel 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.
what is wrong with printf("the problem is %s \n",$t);
or
echo ("the problem is".$t);
???
--
To people who know nothing, anything is possible.
To people who know too much, it is a sad fact
that they know how little is really possible -
and how hard it is to achieve it.
.
- Follow-Ups:
- Re: variable replacement in string
- From: M. Strobel
- Re: variable replacement in string
- References:
- variable replacement in string
- From: M. Strobel
- variable replacement in string
- Prev by Date: variable replacement in string
- Next by Date: Re: variable replacement in string
- Previous by thread: variable replacement in string
- Next by thread: Re: variable replacement in string
- Index(es):
Relevant Pages
|