3v4l.org

run code in 300+ PHP versions simultaneously
<?php function parsingUtm($utmStr, $utmName) { $start = strpos($utmStr, 'source') + strlen($utmName) + 1; if($utmName != 'content'){ $end = strpos($utmStr, 'utm', $start) - 1; } else { $end = strlen($utmStr); } return substr($utmStr, $start, $end); } $utmStr = 'http://vk.com/?utm_source=yandex&utm_medium=cpc&utm_campaign={campaign_id}&utm_content={ad_id}&utm_term={keyword}'; var_dump(parsingUtm($utmStr, 'content'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xe4Y4
function name:  (null)
number of ops:  9
compiled vars:  !0 = $utmStr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, 'http%3A%2F%2Fvk.com%2F%3Futm_source%3Dyandex%26utm_medium%3Dcpc%26utm_campaign%3D%7Bcampaign_id%7D%26utm_content%3D%7Bad_id%7D%26utm_term%3D%7Bkeyword%7D'
   18     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'parsingutm'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'content'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function parsingutm:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 20
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Xe4Y4
function name:  parsingUtm
number of ops:  29
compiled vars:  !0 = $utmStr, !1 = $utmName, !2 = $start, !3 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 'source'
          5        DO_ICALL                                         $4      
          6        STRLEN                                           ~5      !1
          7        ADD                                              ~6      $4, ~5
          8        ADD                                              ~7      ~6, 1
          9        ASSIGN                                                   !2, ~7
    7    10        IS_NOT_EQUAL                                             !1, 'content'
         11      > JMPZ                                                     ~9, ->20
    8    12    >   INIT_FCALL                                               'strpos'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 'utm'
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $10     
         17        SUB                                              ~11     $10, 1
         18        ASSIGN                                                   !3, ~11
         19      > JMP                                                      ->22
   11    20    >   STRLEN                                           ~13     !0
         21        ASSIGN                                                   !3, ~13
   14    22    >   INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !0
         24        SEND_VAR                                                 !2
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                         $15     
         27      > RETURN                                                   $15
   15    28*     > RETURN                                                   null

End of function parsingutm

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165 ms | 1394 KiB | 20 Q