3v4l.org

run code in 300+ 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 = 19, Position 2 = 27
Branch analysis from position: 19
2 jumps found. (Code = 126) Position 1 = 20, Position 2 = 27
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/hPomL
function name:  (null)
number of ops:  32
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        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5C%5Bmtgcard%5C%5D%28.%2A%3F%29%5C%5B%5C%2Fmtgcard%5C%5D%2F'
          4        SEND_VAL                                                 '%3Ca+href%3D%22https%3A%2F%2Fdeckbox.org%2Fmtg%2F%241%22%3E%241%3C%2Fa%3E'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !0, $6
    7     8        ECHO                                                     !0
    9     9        ASSIGN                                                   !0, 'we+have+a+card++%5Bmtgcard%5Dtarmogoyf%5B%2Fmtgcard%5D+'
   10    10        ASSIGN_OP                                     8          !0, 'and+%5Bmtgcard%5Dforest%5B%2Fmtgcard%5D+'
   12    11        INIT_FCALL                                               'preg_match_all'
         12        SEND_VAL                                                 '%2F%5C%5Bmtgcard%5C%5D%28.%2A%3F%29%5C%5B%5C%2Fmtgcard%5C%5D%2F'
         13        SEND_VAR                                                 !0
         14        SEND_REF                                                 !1
         15        DO_ICALL                                                 
   13    16        FETCH_DIM_R                                      ~11     !1, 1
         17        ASSIGN                                                   !2, ~11
   14    18      > FE_RESET_RW                                      $13     !2, ->27
         19    > > FE_FETCH_RW                                              $13, !3, ->27
   15    20    >   ROPE_INIT                                     5  ~15     '%3Ca+href%3D%22https%3A%2F%2Fdeckbox.org%2Fmtg%2F'
         21        ROPE_ADD                                      1  ~15     ~15, !3
         22        ROPE_ADD                                      2  ~15     ~15, '%22%3E'
         23        ROPE_ADD                                      3  ~15     ~15, !3
         24        ROPE_END                                      4  ~14     ~15, '%3C%2Fa%3E'
         25        ASSIGN                                                   !3, ~14
   14    26      > JMP                                                      ->19
         27    >   FE_FREE                                                  $13
   17    28        INIT_FCALL                                               'print_r'
         29        SEND_VAR                                                 !2
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.15 ms | 1401 KiB | 19 Q