3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Parse the url. $addr = "http://www.example.com/?pk_lol=VAgin&utm_campaign=printemps&utm_medium=e-mail&utm_source=newsletter1&utm_content=lien-en-haut"; $tableName = array ('referer_medium', 'referer_source', 'referer_campaign'); $source = array ('utm_campaign=', 'utm_medium=', 'utm_source='); $pattern ="/({$source[0]}.[^&]+)&({$source[1]}.[^&]+)&({$source[2]}.[^&]+)&/"; preg_match($pattern, $addr, $result); foreach (range(0,2) as $i) { $visitorInfo['{$tableName[$i]}'] = substr($result[$i+1], strlen($source[$i])); } print_r($visitorInfo);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 36
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 36
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/a1F5I
function name:  (null)
number of ops:  41
compiled vars:  !0 = $addr, !1 = $tableName, !2 = $source, !3 = $pattern, !4 = $result, !5 = $i, !6 = $visitorInfo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fwww.example.com%2F%3Fpk_lol%3DVAgin%26utm_campaign%3Dprintemps%26utm_medium%3De-mail%26utm_source%3Dnewsletter1%26utm_content%3Dlien-en-haut'
    6     1        ASSIGN                                                   !1, <array>
    7     2        ASSIGN                                                   !2, <array>
    8     3        ROPE_INIT                                     7  ~14     '%2F%28'
          4        FETCH_DIM_R                                      ~10     !2, 0
          5        ROPE_ADD                                      1  ~14     ~14, ~10
          6        ROPE_ADD                                      2  ~14     ~14, '.%5B%5E%26%5D%2B%29%26%28'
          7        FETCH_DIM_R                                      ~11     !2, 1
          8        ROPE_ADD                                      3  ~14     ~14, ~11
          9        ROPE_ADD                                      4  ~14     ~14, '.%5B%5E%26%5D%2B%29%26%28'
         10        FETCH_DIM_R                                      ~12     !2, 2
         11        ROPE_ADD                                      5  ~14     ~14, ~12
         12        ROPE_END                                      6  ~13     ~14, '.%5B%5E%26%5D%2B%29%26%2F'
         13        ASSIGN                                                   !3, ~13
   10    14        INIT_FCALL                                               'preg_match'
         15        SEND_VAR                                                 !3
         16        SEND_VAR                                                 !0
         17        SEND_REF                                                 !4
         18        DO_ICALL                                                 
   14    19        INIT_FCALL                                               'range'
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 2
         22        DO_ICALL                                         $20     
         23      > FE_RESET_R                                       $21     $20, ->36
         24    > > FE_FETCH_R                                               $21, !5, ->36
   15    25    >   INIT_FCALL                                               'substr'
         26        ADD                                              ~23     !5, 1
         27        FETCH_DIM_R                                      ~24     !4, ~23
         28        SEND_VAL                                                 ~24
         29        FETCH_DIM_R                                      ~25     !2, !5
         30        STRLEN                                           ~26     ~25
         31        SEND_VAL                                                 ~26
         32        DO_ICALL                                         $27     
         33        ASSIGN_DIM                                               !6, '%7B%24tableName%5B%24i%5D%7D'
         34        OP_DATA                                                  $27
   14    35      > JMP                                                      ->24
         36    >   FE_FREE                                                  $21
   18    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !6
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.16 ms | 1400 KiB | 21 Q