Usage:
String::insert(
'My name is {:name} and I am {:age} years old.',
array('name' => 'Bob', 'age' => '65')
); // returns 'My name is Bob and I am 65 years old.'
Please note that optimization have applied to this method and parts of the code
may look like it can refactored or removed but in fact this is part of the applied
optimization. Please check the history for this section of code before refactoring
public static insert ( string $str, array $data, array $options = [] ) : string | ||
$str | string | A string containing variable place-holders. |
$data | array | A key, value array where each key stands for a place-holder variable name to be replaced with value. |
$options | array | Available options are: - `'after'`: The character or string after the name of the variable place-holder (defaults to `}`). - `'before'`: The character or string in front of the name of the variable place-holder (defaults to `'{:'`). - `'clean'`: A boolean or array with instructions for `String::clean()`. - `'escape'`: The character or string used to escape the before character or string (defaults to `'\'`). - `'format'`: A regular expression to use for matching variable place-holders (defaults to `'/(? |
return | string |