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"; 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: $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); 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/GgRsj
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'
    6     2        ASSIGN                                                   !0, 'AntivirusSecurity_3542683-1.apk'
   27     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 = 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 = 39, Position 2 = 42
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GgRsj
function name:  extract_click_id_from_filename
number of ops:  43
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
-------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                        !0      ''
   11     1        ASSIGN                                                   !1, 'cb-'
   12     2        ASSIGN                                                   !2, '-ce'
   13     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                                                 
   15    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
   16    17    >   FETCH_DIM_R                                      ~14     !3, 1
         18        FETCH_DIM_R                                      ~15     ~14, 0
         19      > RETURN                                                   ~15
   19    20    >   ASSIGN                                                   !1, 'AntivirusSecurity_'
   20    21        ASSIGN                                                   !2, '%5C.apk'
   21    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'
         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                                                 
   23    32        INIT_FCALL                                               'print_r'
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                                 
   24    35        FETCH_DIM_IS                                     ~24     !3, 1
         36        ISSET_ISEMPTY_DIM_OBJ                         1  ~25     ~24, 0
         37        BOOL_NOT                                         ~26     ~25
         38      > JMPZ                                                     ~26, ->42
   25    39    >   FETCH_DIM_R                                      ~27     !3, 1
         40        FETCH_DIM_R                                      ~28     ~27, 0
         41      > RETURN                                                   ~28
   26    42    > > RETURN                                                   null

End of function extract_click_id_from_filename

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.54 ms | 1394 KiB | 18 Q