Usage:
{{{
Text::insert(
'My name is {:name} and I am {:age} years old.', ['name' => 'Bob', 'age' => '65']
);
}}}
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: - `'before'`: The character or string in front of the name of the variable place-holder (defaults to `'{:'`). - `'after'`: The character or string after the name of the variable place-holder (defaults to `}`). - `'escape'`: The character or string used to escape the before character or string (defaults to `'\\'`). - `'clean'`: A boolean or array with instructions for `Text::clean()`. |
리턴 | string |