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"; $app_filename = "AntivirusSecurity_cb-3590671-ce.apk"; function extract_click_id_from_filename($app_filename=''){ $minimum_click_id_length = 4; if(empty($app_filename)) return NULL; // 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/5lVHU
function name:  (null)
number of ops:  8
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'
    8     2        ASSIGN                                                   !0, 'AntivirusSecurity_cb-3590671-ce.apk'
   44     3        INIT_FCALL                                               'extract_click_id_from_filename'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
          7      > RETURN                                                   1

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

End of function extract_click_id_from_filename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.87 ms | 1407 KiB | 16 Q