Str::template()
Replaces placeholders in string with value from array
Parameters
Name | Type | Default | Description |
---|---|---|---|
$string | string |
null |
The string with placeholders |
$data | array |
[ ] |
Associative array with placeholders as keys and replacements as values |
$fallback | string |array |null |
null |
An options array that contains: - fallback: if a token does not have any matches - callback: to be able to handle each matching result - start: start placeholder - end: end placeholder A simple fallback string is supported for compatibility (but deprecated). |
$start | string |
'{{' |
Placeholder start characters |
$end | string |
'}}' |
Placeholder end characters |
Return type
string