3v4l.org

run code in 300+ PHP versions simultaneously
<html> <code> <pre> <?php $html = '[link href="http://www.google.com" title="Google" target="_blank"]Google[/link] [link href="http://www.google.com" title="Google" target="_blank"]Google[/link]sdfsdfs[link href="http://www.google.com" title="Google" target="_blank"]Google[/link] [link href="http://www.google.com" title="Google" target="_blank"]Google[/link]'; $regex = '#(?:.*?\[link|\G)\K(?:\s+([^=\s]+)=["\'](.*?)["\']|.*?\](.*?)\[/link\])#i'; preg_match_all($regex, $html, $matches, PREG_SET_ORDER); $links = array(); $reset = true; foreach($matches as $match) { if($reset) { $links[] = array( 'params' => array(), 'value' => null ); $reset = false; } end($links); $key = key($links); if(isset($match[3])) { $links[$key]['value'] = $match[3]; $reset = true; } else { $links[$key]['params'][$match[1]] = $match[2]; } } var_dump($links);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 39
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 39
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 32
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 17
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/fCJCg
function name:  (null)
number of ops:  44
compiled vars:  !0 = $html, !1 = $regex, !2 = $matches, !3 = $links, !4 = $reset, !5 = $match, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3Chtml%3E%0A%3Ccode%3E%0A%3Cpre%3E%0A'
    5     1        ASSIGN                                                   !0, '%5Blink+href%3D%22http%3A%2F%2Fwww.google.com%22+title%3D%22Google%22+target%3D%22_blank%22%5DGoogle%5B%2Flink%5D+%5Blink+href%3D%22http%3A%2F%2Fwww.google.com%22+title%3D%22Google%22+target%3D%22_blank%22%5DGoogle%5B%2Flink%5Dsdfsdfs%5Blink+href%3D%22http%3A%2F%2Fwww.google.com%22+title%3D%22Google%22+target%3D%22_blank%22%5DGoogle%5B%2Flink%5D%0A%5Blink+href%3D%22http%3A%2F%2Fwww.google.com%22+title%3D%22Google%22+target%3D%22_blank%22%5DGoogle%5B%2Flink%5D'
    8     2        ASSIGN                                                   !1, '%23%28%3F%3A.%2A%3F%5C%5Blink%7C%5CG%29%5CK%28%3F%3A%5Cs%2B%28%5B%5E%3D%5Cs%5D%2B%29%3D%5B%22%27%5D%28.%2A%3F%29%5B%22%27%5D%7C.%2A%3F%5C%5D%28.%2A%3F%29%5C%5B%2Flink%5C%5D%29%23i'
    9     3        INIT_FCALL                                               'preg_match_all'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        SEND_REF                                                 !2
          7        SEND_VAL                                                 2
          8        DO_ICALL                                                 
   11     9        ASSIGN                                                   !3, <array>
   12    10        ASSIGN                                                   !4, <true>
   14    11      > FE_RESET_R                                       $12     !2, ->39
         12    > > FE_FETCH_R                                               $12, !5, ->39
   15    13    > > JMPZ                                                     !4, ->17
   16    14    >   ASSIGN_DIM                                               !3
   17    15        OP_DATA                                                  <array>
   21    16        ASSIGN                                                   !4, <false>
   24    17    >   INIT_FCALL                                               'end'
         18        SEND_REF                                                 !3
         19        DO_ICALL                                                 
   25    20        INIT_FCALL                                               'key'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $16     
         23        ASSIGN                                                   !6, $16
   27    24        ISSET_ISEMPTY_DIM_OBJ                         0          !5, 3
         25      > JMPZ                                                     ~18, ->32
   28    26    >   FETCH_DIM_R                                      ~21     !5, 3
         27        FETCH_DIM_W                                      $19     !3, !6
         28        ASSIGN_DIM                                               $19, 'value'
         29        OP_DATA                                                  ~21
   29    30        ASSIGN                                                   !4, <true>
         31      > JMP                                                      ->38
   31    32    >   FETCH_DIM_R                                      ~25     !5, 1
         33        FETCH_DIM_R                                      ~27     !5, 2
         34        FETCH_DIM_W                                      $23     !3, !6
         35        FETCH_DIM_W                                      $24     $23, 'params'
         36        ASSIGN_DIM                                               $24, ~25
         37        OP_DATA                                                  ~27
   14    38    > > JMP                                                      ->12
         39    >   FE_FREE                                                  $12
   35    40        INIT_FCALL                                               'var_dump'
         41        SEND_VAR                                                 !3
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.95 ms | 1400 KiB | 21 Q