3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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); }
Output for 7.1.0 - 7.2.0
Array ( [0] => <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> [1] => class="FootnoteText" style="text-align:left" [2] => <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> ) Warning: A non-numeric value encountered in /in/etR01 on line 21
Output for 5.3.19 - 7.0.20
Array ( [0] => <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> [1] => class="FootnoteText" style="text-align:left" [2] => <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> )