title: PHP variable replacement
body: <p>Is there any function which replaces params in a string? Something like this:</p>
  
  <p>Code:</p>
  
  <pre><code>$format_str = "My name is %name."; /* this was set in a 
                                        configuration file - config.php */
  
  $str = xprintf($format_str, array('name' =&gt; 'Joe', 'age' =&gt; 150)); 
                /* above is somewhere in main code */
  </code></pre>
  
  <p>The expected value of $str after the operation is:</p>
  
  <pre><code>My name is Joe.
  </code></pre>
  
  <p>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.</p>