33 lines
540 B
PHP
33 lines
540 B
PHP
<?php
|
|
|
|
namespace rosavox\helpers\string_;
|
|
|
|
|
|
/**
|
|
*/
|
|
function coin(string $template, array $arguments) : string
|
|
{
|
|
$result = $template;
|
|
foreach ($arguments as $key => $value)
|
|
{
|
|
$result = \str_replace(\sprintf('{{%s}}', $key), $value, $result);
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
function replace_all(
|
|
string $string,
|
|
array $replacements
|
|
) : string
|
|
{
|
|
$result = $string;
|
|
foreach ($replacement as $replacement_key => $replacement_value) {
|
|
$result = \str_replace($replacement_key, $replacement_value, $result);
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
?>
|