3v4l.org

run code in 500+ PHP versions simultaneously
<?php $source = '<p>Today, not only we have so many breeds that are trained this and that.</p> <h4><strong>We must add a dot after the closing strong</strong></h4> <p>Hunting with your dog is a blah blah with each other.</p> <h2>No need to change this one!</h2> <p>Hunting with your dog is a blah blah with each other.</p>'; $source = addMissingPunctuation( $source ); echo $source; function addMissingPunctuation( $input ) { return preg_replace("/[^,.;!?]\K(<\/h[1-6]>)/mi", ".$0", $input); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6dNV7
function name:  (null)
number of ops:  7
compiled vars:  !0 = $source
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3Cp%3EToday%2C+not+only+we+have+so+many+breeds+that+are+trained+this+and+that.%3C%2Fp%3E%0A%0A%3Ch4%3E%3Cstrong%3EWe+must+add+a+dot+after+the+closing+strong%3C%2Fstrong%3E%3C%2Fh4%3E%0A%0A%3Cp%3EHunting+with+your+dog+is+a+blah+blah+with+each+other.%3C%2Fp%3E%0A%0A%3Ch2%3ENo+need+to+change+this+one%21%3C%2Fh2%3E%0A%0A%3Cp%3EHunting+with+your+dog+is+a+blah+blah+with+each+other.%3C%2Fp%3E'
   11     1        INIT_FCALL_BY_NAME                                           'addMissingPunctuation'
          2        SEND_VAR_EX                                                  !0
          3        DO_FCALL                                          0  $2      
          4        ASSIGN                                                       !0, $2
   12     5        ECHO                                                         !0
   15     6      > RETURN                                                       1

Function addmissingpunctuation:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6dNV7
function name:  addMissingPunctuation
number of ops:  5
compiled vars:  !0 = $input
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
   14     1        FRAMELESS_ICALL_3                preg_replace        ~1      '%2F%5B%5E%2C.%3B%21%3F%5D%5CK%28%3C%5C%2Fh%5B1-6%5D%3E%29%2Fmi', '.%240'
          2        OP_DATA                                                      !0
          3      > RETURN                                                       ~1
   15     4*     > RETURN                                                       null

End of function addmissingpunctuation

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.72 ms | 2246 KiB | 13 Q