3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
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> ) Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /in/etR01:21 Stack trace: #0 [internal function]: replaceMatches(Array) #1 /in/etR01(10): preg_replace_callback('/<p(.*?)>(.*?)<...', 'replaceMatches', '<div id="_ftn88...') #2 {main} thrown in /in/etR01 on line 21
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 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> ) Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /in/etR01:21 Stack trace: #0 [internal function]: replaceMatches(Array) #1 /in/etR01(10): preg_replace_callback('/<p(.*?)>(.*?)<...', 'replaceMatches', '<div id="_ftn88...') #2 {main} thrown in /in/etR01 on line 21
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27
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> ) Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /in/etR01:21 Stack trace: #0 [internal function]: replaceMatches(Array) #1 /in/etR01(13): preg_replace_callback('/<p(.*?)>(.*?)<...', 'replaceMatches', '<div id="_ftn88...') #2 {main} thrown in /in/etR01 on line 21
Process exited with code 255.
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
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.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 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> )

preferences:
174.39 ms | 403 KiB | 182 Q