3v4l.org

run code in 300+ 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/jGZal
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/jGZal
function name:  addMissingPunctuation
number of ops:  8
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%5B%5E%2C.%3B%21%3F%5D%5CK%3C%5C%2Fh%5B1-6%5D%3E%2Fmi'
          3        SEND_VAL                                                 '.%5C0'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
   15     7*     > RETURN                                                   null

End of function addmissingpunctuation

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.32 ms | 1010 KiB | 14 Q