3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string="{1},[2],(3),<4>"; $string = preg_replace_callback('~([{[<])|[]}>]~', function ($m) { return !empty($m[1]) ? "(" : ")"; }, $string); echo $string;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NXjTp
function name:  (null)
number of ops:  10
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B1%7D%2C%5B2%5D%2C%283%29%2C%3C4%3E'
    4     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7E%28%5B%7B%5B%3C%5D%29%7C%5B%5D%7D%3E%5D%7E'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FNXjTp%3A4%240'
    6     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
    4     7        ASSIGN                                                   !0, $3
    7     8        ECHO                                                     !0
    8     9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FNXjTp%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NXjTp
function name:  {closure}
number of ops:  9
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, ->6
          4    >   QM_ASSIGN                                        ~3      '%28'
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      '%29'
          7    > > RETURN                                                   ~3
    6     8*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.72 ms | 1395 KiB | 15 Q