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_1.apk"; function extract_click_id_from_filename($app_filename=''){ $minimum_click_id_length = 4; // 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]*?){$click_id_fence_end}^", $app_filename, $fields); if(!empty($fields[1][0]) && strlen($fields[1][0]) >= $minimum_click_id_length) 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]*?){$click_id_fence_end}^", $app_filename, $fields); if(!empty($fields[1][0]) && strlen($fields[1][0]) >= $minimum_click_id_length) return $fields[1][0]; // default: return NULL; } 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/Dj83t
function name:  (null)
number of ops:  7
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'
   39     2        INIT_FCALL                                               'extract_click_id_from_filename'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
          6      > RETURN                                                   1

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

End of function extract_click_id_from_filename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.74 ms | 1407 KiB | 16 Q