3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = 'This is a demo paragraph with a wrapped string ~here~, with another string ~~here~~.'; echo preg_replace_callback('/~~([\s\S]*?)~~(?!~)|~([^~]*)~/', function ($m) { return !empty($m[1]) ? '<span class="classTwo">' . $m[1] . '</span>' : '<span class="classOne">' . $m[2] . '</span>'; },$html);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/graet
function name:  (null)
number of ops:  9
compiled vars:  !0 = $html
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'This+is+a+demo+paragraph+with+a+wrapped+string+%7Ehere%7E%2C+with+another+string+%7E%7Ehere%7E%7E.'
    4     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%7E%7E%28%5B%5Cs%5CS%5D%2A%3F%29%7E%7E%28%3F%21%7E%29%7C%7E%28%5B%5E%7E%5D%2A%29%7E%2F'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fgraet%3A4%240'
    6     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        ECHO                                                     $3
          8      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fgraet%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/graet
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ISSET_ISEMPTY_DIM_OBJ                         1  ~1      !0, 1
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->9
          4    >   FETCH_DIM_R                                      ~3      !0, 1
          5        CONCAT                                           ~4      '%3Cspan+class%3D%22classTwo%22%3E', ~3
          6        CONCAT                                           ~5      ~4, '%3C%2Fspan%3E'
          7        QM_ASSIGN                                        ~6      ~5
          8      > JMP                                                      ->13
          9    >   FETCH_DIM_R                                      ~7      !0, 2
         10        CONCAT                                           ~8      '%3Cspan+class%3D%22classOne%22%3E', ~7
         11        CONCAT                                           ~9      ~8, '%3C%2Fspan%3E'
         12        QM_ASSIGN                                        ~6      ~9
         13    > > RETURN                                                   ~6
    6    14*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.75 ms | 1396 KiB | 15 Q