3v4l.org

run code in 300+ PHP versions simultaneously
<?php function maskString($string) { return preg_replace('/(?<=.).(?=.*)/u','*',$string); } function maskEmail($email) { $arremail = explode('@',$email); $arrdomain = explode('.',$arremail[1]); $jumdomain = count($arrdomain); echo $jumdomain[0]; $dom = array(); for($i=0; $i<$jumdomain-1; $i++) { $dom[] = maskString($jumdomain[$i]); } $domain = implode('.',$dom); //$email1 = preg_replace('/(?<=.).(?=.*@)/u','*',$arremail[0].'@'); //$email2 = preg_replace('/(?<=.).(?=.*[.])/u','*',$arremail[1]); //return $email1.$email2; return maskString($arremail[0]).'@'.$domain; } $email = 'facebook@yahoo.co.id'; $result = maskEmail($email); echo $result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ValYX
function name:  (null)
number of ops:  7
compiled vars:  !0 = $email, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   ASSIGN                                                   !0, 'facebook%40yahoo.co.id'
   25     1        INIT_FCALL                                               'maskemail'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   26     5        ECHO                                                     !1
          6      > RETURN                                                   1

Function maskstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ValYX
function name:  maskString
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F%28%3F%3C%3D.%29.%28%3F%3D.%2A%29%2Fu'
          3        SEND_VAL                                                 '%2A'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
    5     7*     > RETURN                                                   null

End of function maskstring

Function maskemail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 19
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 19
Branch analysis from position: 29
Branch analysis from position: 19
filename:       /in/ValYX
function name:  maskEmail
number of ops:  42
compiled vars:  !0 = $email, !1 = $arremail, !2 = $arrdomain, !3 = $jumdomain, !4 = $dom, !5 = $i, !6 = $domain
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%40'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
   10     6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '.'
          8        FETCH_DIM_R                                      ~9      !1, 1
          9        SEND_VAL                                                 ~9
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !2, $10
   11    12        COUNT                                            ~12     !2
         13        ASSIGN                                                   !3, ~12
   12    14        FETCH_DIM_R                                      ~14     !3, 0
         15        ECHO                                                     ~14
   13    16        ASSIGN                                                   !4, <array>
   14    17        ASSIGN                                                   !5, 0
         18      > JMP                                                      ->26
   16    19    >   INIT_FCALL                                               'maskstring'
         20        FETCH_DIM_R                                      ~18     !3, !5
         21        SEND_VAL                                                 ~18
         22        DO_FCALL                                      0  $19     
         23        ASSIGN_DIM                                               !4
         24        OP_DATA                                                  $19
   14    25        PRE_INC                                                  !5
         26    >   SUB                                              ~21     !3, 1
         27        IS_SMALLER                                               !5, ~21
         28      > JMPNZ                                                    ~22, ->19
   18    29    >   INIT_FCALL                                               'implode'
         30        SEND_VAL                                                 '.'
         31        SEND_VAR                                                 !4
         32        DO_ICALL                                         $23     
         33        ASSIGN                                                   !6, $23
   22    34        INIT_FCALL                                               'maskstring'
         35        FETCH_DIM_R                                      ~25     !1, 0
         36        SEND_VAL                                                 ~25
         37        DO_FCALL                                      0  $26     
         38        CONCAT                                           ~27     $26, '%40'
         39        CONCAT                                           ~28     ~27, !6
         40      > RETURN                                                   ~28
   23    41*     > RETURN                                                   null

End of function maskemail

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.86 ms | 1407 KiB | 22 Q