3v4l.org

run code in 300+ PHP versions simultaneously
<?php $email = 'johnsnow123@ヒキワリ.ナットウ.ニホン'; $localAndDomain = explode('@', $email); if (count($localAndDomain) !== 2) { echo 'invalid'; } $local = $localAndDomain[0]; $localExpression = '^[a-z0-9_-]+(?:[a-z0-9._%+-]+)*$'; if (mb_eregi($localExpression, $local) === false) { echo 'invalid'; } // Handle IDN domains $domain = $localAndDomain[1]; $domain = str_replace('xn--', '', idn_to_ascii($domain)); $dictionary = Helper::$VALID_DOMAINS; $domainExpression = '^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+(?:[A-Z]{2}|' . implode('|', $dictionary) . ')$'; if (mb_eregi($domainExpression, $domain) === false) { echo 'invalid'; } echo 'valid';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 47
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
Branch analysis from position: 20
Branch analysis from position: 10
filename:       /in/C4Fol
function name:  (null)
number of ops:  49
compiled vars:  !0 = $email, !1 = $localAndDomain, !2 = $local, !3 = $localExpression, !4 = $domain, !5 = $dictionary, !6 = $domainExpression
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'johnsnow123%40%E3%83%92%E3%82%AD%E3%83%AF%E3%83%AA.%E3%83%8A%E3%83%83%E3%83%88%E3%82%A6.%E3%83%8B%E3%83%9B%E3%83%B3'
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%40'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
    6     6        COUNT                                            ~10     !1
          7        IS_NOT_IDENTICAL                                         ~10, 2
          8      > JMPZ                                                     ~11, ->10
    7     9    >   ECHO                                                     'invalid'
   10    10    >   FETCH_DIM_R                                      ~12     !1, 0
         11        ASSIGN                                                   !2, ~12
   11    12        ASSIGN                                                   !3, '%5E%5Ba-z0-9_-%5D%2B%28%3F%3A%5Ba-z0-9._%25%2B-%5D%2B%29%2A%24'
   12    13        INIT_FCALL                                               'mb_eregi'
         14        SEND_VAR                                                 !3
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $15     
         17        TYPE_CHECK                                    4          $15
         18      > JMPZ                                                     ~16, ->20
   13    19    >   ECHO                                                     'invalid'
   17    20    >   FETCH_DIM_R                                      ~17     !1, 1
         21        ASSIGN                                                   !4, ~17
   18    22        INIT_FCALL                                               'str_replace'
         23        SEND_VAL                                                 'xn--'
         24        SEND_VAL                                                 ''
         25        INIT_FCALL_BY_NAME                                       'idn_to_ascii'
         26        SEND_VAR_EX                                              !4
         27        DO_FCALL                                      0  $19     
         28        SEND_VAR                                                 $19
         29        DO_ICALL                                         $20     
         30        ASSIGN                                                   !4, $20
   20    31        FETCH_STATIC_PROP_R          unknown             ~22     'VALID_DOMAINS'
         32        ASSIGN                                                   !5, ~22
   21    33        INIT_FCALL                                               'implode'
         34        SEND_VAL                                                 '%7C'
         35        SEND_VAR                                                 !5
         36        DO_ICALL                                         $24     
         37        CONCAT                                           ~25     '%5E%28%3F%3A%5Ba-z0-9%5D%28%3F%3A%5Ba-z0-9-%5D%2A%5Ba-z0-9%5D%29%3F%5C.%29%2B%28%3F%3A%5BA-Z%5D%7B2%7D%7C', $24
         38        CONCAT                                           ~26     ~25, '%29%24'
         39        ASSIGN                                                   !6, ~26
   23    40        INIT_FCALL                                               'mb_eregi'
         41        SEND_VAR                                                 !6
         42        SEND_VAR                                                 !4
         43        DO_ICALL                                         $28     
         44        TYPE_CHECK                                    4          $28
         45      > JMPZ                                                     ~29, ->47
   24    46    >   ECHO                                                     'invalid'
   27    47    >   ECHO                                                     'valid'
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.59 ms | 1400 KiB | 24 Q