3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = "we have a card [mtgcard]tarmogoyf[/mtgcard] "; $string .= "and [mtgcard]forest[/mtgcard] "; $string = preg_replace('/\[mtgcard\](.*?)\[\/mtgcard\]/', '<a href="https://deckbox.org/mtg/$1">$1</a>', $string); echo $string; $string = "we have a card [mtgcard]tarmogoyf[/mtgcard] "; $string .= "and [mtgcard]forest[/mtgcard] "; preg_match_all('/\[mtgcard\](.*?)\[\/mtgcard\]/', $string, $matches); $arr = $matches[1]; foreach ($arr as &$a) { $a = "<a href=\"https://deckbox.org/mtg/$a\">$a</a>"; } print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 16, Position 2 = 24
Branch analysis from position: 16
2 jumps found. (Code = 126) Position 1 = 17, Position 2 = 24
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/hPomL
function name:  (null)
number of ops:  29
compiled vars:  !0 = $string, !1 = $matches, !2 = $arr, !3 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'we+have+a+card++%5Bmtgcard%5Dtarmogoyf%5B%2Fmtgcard%5D+'
    4     1        ASSIGN_OP                                         8          !0, 'and+%5Bmtgcard%5Dforest%5B%2Fmtgcard%5D+'
    6     2        FRAMELESS_ICALL_3                preg_replace        ~6      '%2F%5C%5Bmtgcard%5C%5D%28.%2A%3F%29%5C%5B%5C%2Fmtgcard%5C%5D%2F', '%3Ca+href%3D%22https%3A%2F%2Fdeckbox.org%2Fmtg%2F%241%22%3E%241%3C%2Fa%3E'
          3        OP_DATA                                                      !0
          4        ASSIGN                                                       !0, ~6
    7     5        ECHO                                                         !0
    9     6        ASSIGN                                                       !0, 'we+have+a+card++%5Bmtgcard%5Dtarmogoyf%5B%2Fmtgcard%5D+'
   10     7        ASSIGN_OP                                         8          !0, 'and+%5Bmtgcard%5Dforest%5B%2Fmtgcard%5D+'
   12     8        INIT_FCALL                                                   'preg_match_all'
          9        SEND_VAL                                                     '%2F%5C%5Bmtgcard%5C%5D%28.%2A%3F%29%5C%5B%5C%2Fmtgcard%5C%5D%2F'
         10        SEND_VAR                                                     !0
         11        SEND_REF                                                     !1
         12        DO_ICALL                                                     
   13    13        FETCH_DIM_R                                          ~11     !1, 1
         14        ASSIGN                                                       !2, ~11
   14    15      > FE_RESET_RW                                          $13     !2, ->24
         16    > > FE_FETCH_RW                                                  $13, !3, ->24
   15    17    >   ROPE_INIT                                         5  ~15     '%3Ca+href%3D%22https%3A%2F%2Fdeckbox.org%2Fmtg%2F'
         18        ROPE_ADD                                          1  ~15     ~15, !3
         19        ROPE_ADD                                          2  ~15     ~15, '%22%3E'
         20        ROPE_ADD                                          3  ~15     ~15, !3
         21        ROPE_END                                          4  ~14     ~15, '%3C%2Fa%3E'
         22        ASSIGN                                                       !3, ~14
   14    23      > JMP                                                          ->16
         24    >   FE_FREE                                                      $13
   17    25        INIT_FCALL                                                   'print_r'
         26        SEND_VAR                                                     !2
         27        DO_ICALL                                                     
         28      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.14 ms | 2164 KiB | 15 Q