Re: variable replacement in string [message #178041 is a reply to message #178040] |
Fri, 11 May 2012 08:31 |
M. Strobel
Messages: 386 Registered: December 2011
Karma:
|
Senior Member |
|
|
Am 11.05.2012 09:58, schrieb "Álvaro G. Vicario":
> El 10/05/2012 14:44, M. Strobel escribió/wrote:
>> 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.
>
> You haven't really explained why those three methods fail to meet your requirements
> or how other languages succeed. If we don't know that, any other proposals are likely
> to be a waste of time.
I just want to be sure I did not overlook some possibility, the quest for the truth.
/Str.
|
|
|