3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = '<p>my text 1</p> some other content <p>some other paragraph followed by an html line break</p><br> etc...'; $text = nl2br($text); $regex= '#<\/p>(<br\s?\/?>)#'; $text = preg_replace($regex, '</p>', $text); echo $text;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2RkFb
function name:  (null)
number of ops:  14
compiled vars:  !0 = $text, !1 = $regex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp%3Emy+text+1%3C%2Fp%3E%0Asome+other+content%0A%3Cp%3Esome+other+paragraph+followed+by+an+html+line+break%3C%2Fp%3E%3Cbr%3E%0Aetc...'
    8     1        INIT_FCALL                                               'nl2br'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   10     5        ASSIGN                                                   !1, '%23%3C%5C%2Fp%3E%28%3Cbr%5Cs%3F%5C%2F%3F%3E%29%23'
   11     6        INIT_FCALL                                               'preg_replace'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 '%3C%2Fp%3E'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !0, $6
   12    12        ECHO                                                     !0
   13    13      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.73 ms | 1005 KiB | 15 Q