Proper storage of text with variables?

Develop a designer of texts.

The user works in a WYSIWYG analogue of the ward, then saves the document. The HTML string is sent to the database and stored there. In our constructor is a function, something like "variables". The user can create such variables, and scatter them throughout the text. If in one place to modify the variable, it changes throughout the text. As better things to store?

My version is:

<h1>Some text.</h1>

<p>my name is {{3932}}.</p>

In this case 3932 = Andrew, for example. How about this store? Or is there a more beautiful option?
June 10th 19 at 14:20
3 answers
June 10th 19 at 14:22
Variables it is better to give text names.
if there is a database search, no matter what names - Pedro65 commented on June 10th 19 at 14:25
June 10th 19 at 14:24
... and get the bike type Smarty.

Since I want to do everything yourself, then at least use the mechanism for i18n in your framework. For example, Yii2 is
June 10th 19 at 14:26
Called "templating engine" or just a templating engine. There are plenty of them online.

Find more questions by tags Text processingWeb DevelopmentPHP