3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = "[a,b] some text [b,a] and some more"; $c = 1; echo preg_replace('/\[([^,]+),([^]]+)\]/', $c ? '$1' : '$2', $string) . "\n"; $c = 0; echo preg_replace('/\[([^,]+),([^]]+)\]/', $c ? '$1' : '$2', $string) . "\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
Branch analysis from position: 14
filename:       /in/bXXeO
function name:  (null)
number of ops:  20
compiled vars:  !0 = $string, !1 = $c
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%5Ba%2Cb%5D+some+text+%5Bb%2Ca%5D+and+some+more'
    3     1        ASSIGN                                                       !1, 1
    4     2      > JMPZ                                                         !1, ->5
          3    >   QM_ASSIGN                                            ~4      '%241'
          4      > JMP                                                          ->6
          5    >   QM_ASSIGN                                            ~4      '%242'
          6    >   FRAMELESS_ICALL_3                preg_replace        ~5      '%2F%5C%5B%28%5B%5E%2C%5D%2B%29%2C%28%5B%5E%5D%5D%2B%29%5C%5D%2F', ~4
          7        OP_DATA                                                      !0
          8        CONCAT                                               ~6      ~5, '%0A'
          9        ECHO                                                         ~6
    5    10        ASSIGN                                                       !1, 0
    6    11      > JMPZ                                                         !1, ->14
         12    >   QM_ASSIGN                                            ~8      '%241'
         13      > JMP                                                          ->15
         14    >   QM_ASSIGN                                            ~8      '%242'
         15    >   FRAMELESS_ICALL_3                preg_replace        ~9      '%2F%5C%5B%28%5B%5E%2C%5D%2B%29%2C%28%5B%5E%5D%5D%2B%29%5C%5D%2F', ~8
         16        OP_DATA                                                      !0
         17        CONCAT                                               ~10     ~9, '%0A'
         18        ECHO                                                         ~10
         19      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.67 ms | 2363 KiB | 13 Q