3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'Some text {spoiler}He <span class="just_testing">dies</span> in the end{/spoiler} but {spoiler}not before becoming a Jedi{/spoiler}'; echo preg_replace_callback('~{spoiler}(.*?)({/spoiler})~s', function($m) { return '<span class="spoiler">' . preg_replace('~</?span[^>]*>~i', '', $m[1]) . '</span>'; }, $string, -1, $count); echo "\n---\n"; echo $count;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ioknn
function name:  (null)
number of ops:  13
compiled vars:  !0 = $string, !1 = $count
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Some+text+%7Bspoiler%7DHe+%3Cspan+class%3D%22just_testing%22%3Edies%3C%2Fspan%3E+in+the+end%7B%2Fspoiler%7D+but+%7Bspoiler%7Dnot+before+becoming+a+Jedi%7B%2Fspoiler%7D'
    4     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7E%7Bspoiler%7D%28.%2A%3F%29%28%7B%2Fspoiler%7D%29%7Es'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FIoknn%3A4%240'
    6     4        SEND_VAL                                                 ~3
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 -1
          7        SEND_REF                                                 !1
          8        DO_ICALL                                         $4      
          9        ECHO                                                     $4
    8    10        ECHO                                                     '%0A---%0A'
    9    11        ECHO                                                     !1
   10    12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FIoknn%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ioknn
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%7E%3C%2F%3Fspan%5B%5E%3E%5D%2A%3E%7Ei'
          3        SEND_VAL                                                 ''
          4        FETCH_DIM_R                                      ~1      !0, 1
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $2      
          7        CONCAT                                           ~3      '%3Cspan+class%3D%22spoiler%22%3E', $2
          8        CONCAT                                           ~4      ~3, '%3C%2Fspan%3E'
          9      > RETURN                                                   ~4
    6    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FIoknn%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.29 ms | 1396 KiB | 17 Q