3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = 'text html [button link="google.com" color="#fff" text="this text here"] rest of html'; if (preg_match_all('~(?:\G(?!^)|\[button)\s+(\w+)="([^"]*)"~', $text, $matches)) { print_r(array_combine($matches[1], $matches[2])); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 16
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/qMqXh
function name:  (null)
number of ops:  17
compiled vars:  !0 = $text, !1 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'text+html+%5Bbutton+link%3D%22google.com%22+color%3D%22%23fff%22+text%3D%22this+text+here%22%5D+rest+of+html'
    4     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%7E%28%3F%3A%5CG%28%3F%21%5E%29%7C%5C%5Bbutton%29%5Cs%2B%28%5Cw%2B%29%3D%22%28%5B%5E%22%5D%2A%29%22%7E'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                         $3      
          6      > JMPZ                                                     $3, ->16
    5     7    >   INIT_FCALL                                               'print_r'
          8        INIT_FCALL                                               'array_combine'
          9        FETCH_DIM_R                                      ~4      !1, 1
         10        SEND_VAL                                                 ~4
         11        FETCH_DIM_R                                      ~5      !1, 2
         12        SEND_VAL                                                 ~5
         13        DO_ICALL                                         $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
    6    16    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.92 ms | 1007 KiB | 16 Q