3v4l.org

run code in 300+ PHP versions simultaneously
<?php $app_filename = "AntivirusSecurity_02_cb-508164-ce_ac8a0e5e-35f8-4c7b-b591-7e28cab94b4e.apk"; //$app_filename = "AntivirusSecurity_02_[508164]_ac8a0e5e-35f8-4c7b-b591-7e28cab94b4e.apk"; $app_filename = "AntivirusSecurity_748164.apk"; $app_filename = "AntivirusSecurity_3542683-1.apk"; $app_filename = "AntivirusSecurity_1234.apk"; function extract_click_id_from_filename($app_filename=''){ // New standard format: $click_id_fence_beginning = 'cb-'; $click_id_fence_end = '-ce'; preg_match_all("^{$click_id_fence_beginning}(.*?){$click_id_fence_end}^", $app_filename, $fields); if(!empty($fields[1][0])) return $fields[1][0]; // Legacy format 1: $click_id_fence_beginning = 'AntivirusSecurity_'; $click_id_fence_end = '\.apk'; preg_match_all("^{$click_id_fence_beginning}([0-9]*?){4,}{$click_id_fence_end}^", $app_filename, $fields); if(!empty($fields[1][0])) return $fields[1][0]; // Legacy format 2: $click_id_fence_beginning = 'AntivirusSecurity_'; $click_id_fence_end = '-'; preg_match_all("^{$click_id_fence_beginning}([0-9]*?){4,}{$click_id_fence_end}^", $app_filename, $fields); print_r($fields); if(!empty($fields[1][0])) return $fields[1][0]; } echo extract_click_id_from_filename($app_filename);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KPulT
function name:  (null)
number of ops:  9
compiled vars:  !0 = $app_filename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'AntivirusSecurity_02_cb-508164-ce_ac8a0e5e-35f8-4c7b-b591-7e28cab94b4e.apk'
    5     1        ASSIGN                                                   !0, 'AntivirusSecurity_748164.apk'
    6     2        ASSIGN                                                   !0, 'AntivirusSecurity_3542683-1.apk'
    7     3        ASSIGN                                                   !0, 'AntivirusSecurity_1234.apk'
   36     4        INIT_FCALL                                               'extract_click_id_from_filename'
          5        SEND_VAR                                                 !0
          6        DO_FCALL                                      0  $5      
          7        ECHO                                                     $5
          8      > RETURN                                                   1

Function extract_click_id_from_filename:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 20
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 39
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 58, Position 2 = 61
Branch analysis from position: 58
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KPulT
function name:  extract_click_id_from_filename
number of ops:  62
compiled vars:  !0 = $app_filename, !1 = $click_id_fence_beginning, !2 = $click_id_fence_end, !3 = $fields
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      ''
   12     1        ASSIGN                                                   !1, 'cb-'
   13     2        ASSIGN                                                   !2, '-ce'
   14     3        INIT_FCALL                                               'preg_match_all'
          4        ROPE_INIT                                     5  ~7      '%5E'
          5        ROPE_ADD                                      1  ~7      ~7, !1
          6        ROPE_ADD                                      2  ~7      ~7, '%28.%2A%3F%29'
          7        ROPE_ADD                                      3  ~7      ~7, !2
          8        ROPE_END                                      4  ~6      ~7, '%5E'
          9        SEND_VAL                                                 ~6
         10        SEND_VAR                                                 !0
         11        SEND_REF                                                 !3
         12        DO_ICALL                                                 
   16    13        FETCH_DIM_IS                                     ~11     !3, 1
         14        ISSET_ISEMPTY_DIM_OBJ                         1  ~12     ~11, 0
         15        BOOL_NOT                                         ~13     ~12
         16      > JMPZ                                                     ~13, ->20
   17    17    >   FETCH_DIM_R                                      ~14     !3, 1
         18        FETCH_DIM_R                                      ~15     ~14, 0
         19      > RETURN                                                   ~15
   20    20    >   ASSIGN                                                   !1, 'AntivirusSecurity_'
   21    21        ASSIGN                                                   !2, '%5C.apk'
   22    22        INIT_FCALL                                               'preg_match_all'
         23        ROPE_INIT                                     5  ~19     '%5E'
         24        ROPE_ADD                                      1  ~19     ~19, !1
         25        ROPE_ADD                                      2  ~19     ~19, '%28%5B0-9%5D%2A%3F%29%7B4%2C%7D'
         26        ROPE_ADD                                      3  ~19     ~19, !2
         27        ROPE_END                                      4  ~18     ~19, '%5E'
         28        SEND_VAL                                                 ~18
         29        SEND_VAR                                                 !0
         30        SEND_REF                                                 !3
         31        DO_ICALL                                                 
   24    32        FETCH_DIM_IS                                     ~23     !3, 1
         33        ISSET_ISEMPTY_DIM_OBJ                         1  ~24     ~23, 0
         34        BOOL_NOT                                         ~25     ~24
         35      > JMPZ                                                     ~25, ->39
   25    36    >   FETCH_DIM_R                                      ~26     !3, 1
         37        FETCH_DIM_R                                      ~27     ~26, 0
         38      > RETURN                                                   ~27
   28    39    >   ASSIGN                                                   !1, 'AntivirusSecurity_'
   29    40        ASSIGN                                                   !2, '-'
   30    41        INIT_FCALL                                               'preg_match_all'
         42        ROPE_INIT                                     5  ~31     '%5E'
         43        ROPE_ADD                                      1  ~31     ~31, !1
         44        ROPE_ADD                                      2  ~31     ~31, '%28%5B0-9%5D%2A%3F%29%7B4%2C%7D'
         45        ROPE_ADD                                      3  ~31     ~31, !2
         46        ROPE_END                                      4  ~30     ~31, '%5E'
         47        SEND_VAL                                                 ~30
         48        SEND_VAR                                                 !0
         49        SEND_REF                                                 !3
         50        DO_ICALL                                                 
   32    51        INIT_FCALL                                               'print_r'
         52        SEND_VAR                                                 !3
         53        DO_ICALL                                                 
   33    54        FETCH_DIM_IS                                     ~36     !3, 1
         55        ISSET_ISEMPTY_DIM_OBJ                         1  ~37     ~36, 0
         56        BOOL_NOT                                         ~38     ~37
         57      > JMPZ                                                     ~38, ->61
   34    58    >   FETCH_DIM_R                                      ~39     !3, 1
         59        FETCH_DIM_R                                      ~40     ~39, 0
         60      > RETURN                                                   ~40
   35    61    > > RETURN                                                   null

End of function extract_click_id_from_filename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.3 ms | 1403 KiB | 18 Q