Skip to content

Commit 822a2fb

Browse files
committed
Update Template.php
1 parent f691e9e commit 822a2fb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/ppeco/tplpp/Template.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ public function addValue(string $name, mixed $value): self {
2525
}
2626

2727
public function compile(): string{
28-
if(preg_match_all('/{{([^.]+?)}}/', $this->input, $output,
28+
while(preg_match('/{{([^.]+?)}}/', $this->input, $output,
2929
PREG_OFFSET_CAPTURE)){
30-
for($i = 0, $count = count($output[0]); $i < $count; $i++){
31-
$this->input = substr($this->input, 0, $output[0][$i][1])
32-
.exec($this, $output[1][$i][0])
33-
.substr($this->input, $output[0][$i][1]+$output[1][$i][1], strlen($this->input));
34-
}
30+
$this->input = substr($this->input, 0, $output[0][1])
31+
.exec($this, $output[1][0])
32+
.substr($this->input, $output[0][1]+strlen($output[0][0]), strlen($this->input));
3533
}
3634

3735
return $this->input;

0 commit comments

Comments
 (0)