3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '"hello world" how are you?'; echo preg_replace_callback('~("[^"]+")|\S+~', function($m) { return isset($m[1]) ? "+" . $m[1] : "+" . $m[0] . "*"; }, $str);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y48CQ
function name:  (null)
number of ops:  9
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%22hello+world%22+how+are+you%3F'
    5     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7E%28%22%5B%5E%22%5D%2B%22%29%7C%5CS%2B%7E'
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
    7     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
    5     6        DO_ICALL                                         $3      
    7     7        ECHO                                                     $3
          8      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y48CQ
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 1
          2      > JMPZ                                                     ~1, ->7
          3    >   FETCH_DIM_R                                      ~2      !0, 1
          4        CONCAT                                           ~3      '%2B', ~2
          5        QM_ASSIGN                                        ~4      ~3
          6      > JMP                                                      ->11
          7    >   FETCH_DIM_R                                      ~5      !0, 0
          8        CONCAT                                           ~6      '%2B', ~5
          9        CONCAT                                           ~7      ~6, '%2A'
         10        QM_ASSIGN                                        ~4      ~7
         11    > > RETURN                                                   ~4
    7    12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.74 ms | 954 KiB | 14 Q