3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '<a href="https://example.net">Awesome Button</a> <a href="https://example.net?tag=zero">Awesome Button</a> '; $params = 'param1=blue&param2=red'; echo preg_replace_callback("/(?<=href=[\"'])([^\"'?]+)(?:\?([^\"'?]+))?(?=[\"'])/", function($x) use ($params) { return !empty($x[2]) ? $x[1] . '?' . $params . '&' . $x[2] : $x[1] . '?' . $params; }, $content);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jSTSR
function name:  (null)
number of ops:  11
compiled vars:  !0 = $content, !1 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Ca+href%3D%22https%3A%2F%2Fexample.net%22%3EAwesome+Button%3C%2Fa%3E%0A%3Ca+href%3D%22https%3A%2F%2Fexample.net%3Ftag%3Dzero%22%3EAwesome+Button%3C%2Fa%3E+'
    5     1        ASSIGN                                                   !1, 'param1%3Dblue%26param2%3Dred'
    6     2        INIT_FCALL                                               'preg_replace_callback'
          3        SEND_VAL                                                 '%2F%28%3F%3C%3Dhref%3D%5B%22%27%5D%29%28%5B%5E%22%27%3F%5D%2B%29%28%3F%3A%5C%3F%28%5B%5E%22%27%3F%5D%2B%29%29%3F%28%3F%3D%5B%22%27%5D%29%2F'
          4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
    8     6        SEND_VAL                                                 ~4
          7        SEND_VAR                                                 !0
    6     8        DO_ICALL                                         $5      
    8     9        ECHO                                                     $5
         10      > RETURN                                                   1


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

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.63 ms | 1006 KiB | 14 Q