3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "####KELLY##### and ###ANOTHER###### not ####foo#### but: ###SHARE###MIDDLE###HASHES### ?"; echo $str . "\n"; echo preg_replace('/(?:#{3}|\G(?!^))\K[A-Z](?=[A-Z]*#{3})/', '#', $str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FGgZb
function name:  (null)
number of ops:  10
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%23%23%23%23KELLY%23%23%23%23%23+and+%23%23%23ANOTHER%23%23%23%23%23%23+not+%23%23%23%23foo%23%23%23%23+but%3A+%23%23%23SHARE%23%23%23MIDDLE%23%23%23HASHES%23%23%23+%3F'
    4     1        CONCAT                                           ~2      !0, '%0A'
          2        ECHO                                                     ~2
    5     3        INIT_FCALL                                               'preg_replace'
          4        SEND_VAL                                                 '%2F%28%3F%3A%23%7B3%7D%7C%5CG%28%3F%21%5E%29%29%5CK%5BA-Z%5D%28%3F%3D%5BA-Z%5D%2A%23%7B3%7D%29%2F'
          5        SEND_VAL                                                 '%23'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        ECHO                                                     $3
          9      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.9 ms | 998 KiB | 14 Q