3v4l.org

run code in 300+ PHP versions simultaneously
<?php $addr = "http://10.0.0.4/?utm_source=source1&utm_medium=medium1&utm_campaign=campaign1"; // Parse the url. $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); print_t($result); // Add the values to the log_visit table. 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 = 27, Position 2 = 41
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 41
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/Sk5Sk
function name:  (null)
number of ops:  46
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
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2F10.0.0.4%2F%3Futm_source%3Dsource1%26utm_medium%3Dmedium1%26utm_campaign%3Dcampaign1'
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     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
    7    14        INIT_FCALL                                               'preg_match'
         15        SEND_VAR                                                 !3
         16        SEND_VAR                                                 !0
         17        SEND_REF                                                 !4
         18        DO_ICALL                                                 
    8    19        INIT_FCALL_BY_NAME                                       'print_t'
         20        SEND_VAR_EX                                              !4
         21        DO_FCALL                                      0          
   10    22        INIT_FCALL                                               'range'
         23        SEND_VAL                                                 0
         24        SEND_VAL                                                 2
         25        DO_ICALL                                         $21     
         26      > FE_RESET_R                                       $22     $21, ->41
         27    > > FE_FETCH_R                                               $22, !5, ->41
   11    28    >   FETCH_DIM_R                                      ~23     !1, !5
         29        CAST                                          6  ~24     ~23
         30        INIT_FCALL                                               'substr'
         31        ADD                                              ~26     !5, 1
         32        FETCH_DIM_R                                      ~27     !4, ~26
         33        SEND_VAL                                                 ~27
         34        FETCH_DIM_R                                      ~28     !2, !5
         35        STRLEN                                           ~29     ~28
         36        SEND_VAL                                                 ~29
         37        DO_ICALL                                         $30     
         38        ASSIGN_DIM                                               !6, ~24
         39        OP_DATA                                                  $30
   10    40      > JMP                                                      ->27
         41    >   FE_FREE                                                  $22
   13    42        INIT_FCALL                                               'print_r'
         43        SEND_VAR                                                 !6
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.77 ms | 1400 KiB | 21 Q