I have a PHP variable like this:
Example1
$data = '<p>This is paragraph.</p>
<p title="not-special">No!</p>
';
Example2
$data = '<p>This is paragraph.</p>
<p title="special">Yes!</p>
';
I want to have a php function, that checks whether there's p element with title="special", and if so, insert div element "YAP!".
How can this be done?