3v4l.org

run code in 500+ PHP versions simultaneously
<?php $emails = [ 'a@example.com', // output: a****a@example.com 'ab@example.com', // output: a****b@example.com 'abc@example.com', // output: a****c@example.com 'abcd@example.com', // output: a****d@example.com 'abcde@example.com', // output: a****e@example.com 'abcdef@example.com', // output: a****f@example.com 'abcdefg@example.com', // output: a*****g@example.com <- 5-asterisk-fill 'Ф@example.com', // output: Ф****Ф@example.com 'ФѰ@example.com', // output: Ф****Ѱ@example.com 'ФѰД@example.com', // output: Ф****Д@example.com 'ФѰДӐӘӔӺ@example.com', // output: Ф*****Ӻ@example.com <- 5-asterisk-fill '"a@tricky@one"@example.com', // output: "************"@example.com <- multiple @ in a valid email: no problem ]; $minFill = 4; $mask = preg_replace_callback( '/^(.)(.*?)([^@]?)(?=@[^@]+$)/u', fn($m) => $m[1] . str_repeat("*", max($minFill, mb_strlen($m[2], 'UTF-8'))) . ($m[3] ?: $m[1]), $emails ); var_export(array_combine($emails, $mask));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j3Dj3
function name:  (null)
number of ops:  18
compiled vars:  !0 = $emails, !1 = $minFill, !2 = $mask
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   18     1        ASSIGN                                                       !1, 4
   19     2        INIT_FCALL                                                   'preg_replace_callback'
   20     3        SEND_VAL                                                     '%2F%5E%28.%29%28.%2A%3F%29%28%5B%5E%40%5D%3F%29%28%3F%3D%40%5B%5E%40%5D%2B%24%29%2Fu'
   21     4        DECLARE_LAMBDA_FUNCTION                              ~5      [0]
          5        BIND_LEXICAL                                                 ~5, !1
   23     6        SEND_VAL                                                     ~5
   24     7        SEND_VAR                                                     !0
   19     8        DO_ICALL                                             $6      
          9        ASSIGN                                                       !2, $6
   26    10        INIT_FCALL                                                   'var_export'
         11        INIT_FCALL                                                   'array_combine'
         12        SEND_VAR                                                     !0
         13        SEND_VAR                                                     !2
         14        DO_ICALL                                             $8      
         15        SEND_VAR                                                     $8
         16        DO_ICALL                                                     
         17      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j3Dj3
function name:  {closure:/in/j3Dj3:21}
number of ops:  21
compiled vars:  !0 = $m, !1 = $minFill
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
          2        FETCH_DIM_R                                          ~2      !0, 1
   22     3        INIT_FCALL                                                   'str_repeat'
          4        SEND_VAL                                                     '%2A'
          5        INIT_FCALL                                                   'mb_strlen'
          6        FETCH_DIM_R                                          ~3      !0, 2
          7        SEND_VAL                                                     ~3
          8        SEND_VAL                                                     'UTF-8'
          9        DO_ICALL                                             $4      
         10        FRAMELESS_ICALL_2                max                 ~5      !1, $4
         11        SEND_VAL                                                     ~5
         12        DO_ICALL                                             $6      
         13        CONCAT                                               ~7      ~2, $6
   23    14        FETCH_DIM_R                                          ~8      !0, 3
         15        JMP_SET                                              ~9      ~8, ->18
         16        FETCH_DIM_R                                          ~10     !0, 1
         17        QM_ASSIGN                                            ~9      ~10
         18        CONCAT                                               ~11     ~7, ~9
         19      > RETURN                                                       ~11
         20*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.83 ms | 1807 KiB | 18 Q