- preg_replace_callback: documentation ( source)
- print_r: documentation ( source)
<?php
$text = '<div id="_ftn88">
<p class="FootnoteText" style="text-align:left">
<a href="#_ftnref88"><span class="FootnoteReference" style="font-family:\'Times New Roman\'; font-size:8pt">[88]</span></a><span style="font-family:\'Times New Roman\'; font-size:10pt"> </span><span style="width:7.86pt; text-indent:0pt; display:inline-block"></span><span style="font-family:\'Times New Roman\'; font-size:10pt">At 96.</span>
</p>
</div>';
preg_replace_callback(
"/<p(.*?)>(.*?)<\/p>/s",
"replaceMatches",
$text);
function replaceMatches($matches)
{
// as usual: $matches[0] is the complete match
// $matches[1] the match for the first subpattern
// enclosed in '(...)' and so on
print_r($matches);
return $matches[1].($matches[2]+1);
}