3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "{download='text for buttonzzzz'} HAHA! {download='test'}"; preg_match_all("/{download='(.*?)'}/", $string, $matches, PREG_SET_ORDER); foreach ($matches as $val) { $string = str_replace("{download='" . $val[1] . "'}", "<a class=\"button\">" . $val[1] . "</a>", $string); } echo $string;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 22
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 22
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/S5TEj
function name:  (null)
number of ops:  25
compiled vars:  !0 = $string, !1 = $matches, !2 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7Bdownload%3D%27text+for+buttonzzzz%27%7D+HAHA%21+%7Bdownload%3D%27test%27%7D'
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%7Bdownload%3D%27%28.%2A%3F%29%27%7D%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        SEND_VAL                                                 2
          6        DO_ICALL                                                 
    7     7      > FE_RESET_R                                       $5      !1, ->22
          8    > > FE_FETCH_R                                               $5, !2, ->22
    8     9    >   INIT_FCALL                                               'str_replace'
         10        FETCH_DIM_R                                      ~6      !2, 1
         11        CONCAT                                           ~7      '%7Bdownload%3D%27', ~6
         12        CONCAT                                           ~8      ~7, '%27%7D'
         13        SEND_VAL                                                 ~8
         14        FETCH_DIM_R                                      ~9      !2, 1
         15        CONCAT                                           ~10     '%3Ca+class%3D%22button%22%3E', ~9
         16        CONCAT                                           ~11     ~10, '%3C%2Fa%3E'
         17        SEND_VAL                                                 ~11
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $12     
         20        ASSIGN                                                   !0, $12
    7    21      > JMP                                                      ->8
         22    >   FE_FREE                                                  $5
   11    23        ECHO                                                     !0
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.47 ms | 1395 KiB | 17 Q