I want to use html as a template and filling the data with PHP. If I've some html this way
<h1>${heading-1}</h1>
<p>${paragraph}</p>
I want to replace the template tags with the matching value in my PHP array. If I've an array of all possible matches
$possible_matches = array(
'heading-1'=> 'You can\'t do anything',
'paragraph' => 'Unless you show your code which you don\'t have so be ready for down votes'
);
// what now?
And it changes the html like
<h1>You can't do anything</h1>
<p>Unless you show your code which you don't have so be ready for down votes</p>
How can I achieve this? Should I use regex?