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); $dom = array(); for($i=0; $i<$jumdomain-1; $i++) { $dom[] = maskString($arrdomain[$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/59jNS
function name:  (null)
number of ops:  7
compiled vars:  !0 = $email, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN                                                   !0, 'facebook%40yahoo.co.id'
   24     1        INIT_FCALL                                               'maskemail'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   25     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/59jNS
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 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 17
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 17
Branch analysis from position: 27
Branch analysis from position: 17
filename:       /in/59jNS
function name:  maskEmail
number of ops:  40
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        ASSIGN                                                   !4, <array>
   13    15        ASSIGN                                                   !5, 0
         16      > JMP                                                      ->24
   15    17    >   INIT_FCALL                                               'maskstring'
         18        FETCH_DIM_R                                      ~17     !2, !5
         19        SEND_VAL                                                 ~17
         20        DO_FCALL                                      0  $18     
         21        ASSIGN_DIM                                               !4
         22        OP_DATA                                                  $18
   13    23        PRE_INC                                                  !5
         24    >   SUB                                              ~20     !3, 1
         25        IS_SMALLER                                               !5, ~20
         26      > JMPNZ                                                    ~21, ->17
   17    27    >   INIT_FCALL                                               'implode'
         28        SEND_VAL                                                 '.'
         29        SEND_VAR                                                 !4
         30        DO_ICALL                                         $22     
         31        ASSIGN                                                   !6, $22
   21    32        INIT_FCALL                                               'maskstring'
         33        FETCH_DIM_R                                      ~24     !1, 0
         34        SEND_VAL                                                 ~24
         35        DO_FCALL                                      0  $25     
         36        CONCAT                                           ~26     $25, '%40'
         37        CONCAT                                           ~27     ~26, !6
         38      > RETURN                                                   ~27
   22    39*     > RETURN                                                   null

End of function maskemail

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.47 ms | 1402 KiB | 22 Q