Replace placeholders with the same name by unique values
Placeholder replacement methods such as replaceVariableByText substitute all placeholders in a document with a new value. If a document contains a repeated placeholder that you don't want to replace with the same value, the firstMatch parameter allows to replace only the first result. This way, each time it is called, the next placeholder is replaced with a unique value.
The following code replaces all PLACEHOLDER variables with data of the $values array, substituting only the first match of the variable on every iteration:
Compatible methods with this parameter are: