Is there any function which replaces params in a string? Something like this:
Code:
$format_str = "My name is %name."; /* this was set in a
configuration file - config.php */
$str = xprintf($format_str, array('name' => 'Joe', 'age' => 150));
/* above is somewhere in main code */
The expected value of $str after the operation is:
My name is Joe.
Update: I am aware of sprintf. But, it would not suffice in this case. I have modified the code to show what is the difference.