Skip to content

Str::template()

Replaces placeholders in string with value from array

Str::template(string $string = null, array $data = [ ], string $fallback = null, string $start = '{{', string $end = '}}'): string

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 null A fallback if a token does not have any matches
$start string '{{' Placeholder start characters
$end string '}}' Placeholder end characters

Return type

string

Parent class

Kirby\Toolkit\Str