summaryrefslogtreecommitdiff
path: root/php/replace.php
diff options
context:
space:
mode:
Diffstat (limited to 'php/replace.php')
-rw-r--r--php/replace.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/php/replace.php b/php/replace.php
new file mode 100644
index 0000000..70fdd25
--- /dev/null
+++ b/php/replace.php
@@ -0,0 +1,13 @@
+<?php
+
+function replace(string $templatePath, array $replacements = []): string {
+ $html = file_get_contents($templatePath);
+
+ foreach ($replacements as $placeholder => $replacementValue) {
+ $html = str_replace($placeholder, $replacementValue, $html);
+ }
+
+ return $html;
+}
+
+?>