3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo valid_email('hhh@qq.com'); function valid_email($email) { //有且只有一个@,且不以@开头和结尾 if(!preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $email)) { return false; } $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for($i = 0; $i < sizeof($local_array); $i++) { if (!preg_match("/^(([A-Za-z0-9!#$%&'*+\/=?^_`{|}~-][A-Za-z0-9!#$%&'*+\/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$/", $local_array[$i])) { return false; } } if(!preg_match("/^\[?[0-9\.]+\]?$/", $email_array[1])) { //检查域名合法性 $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!preg_match("/^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$/", $domain_array[$i])) { return false; } } } return true; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FARvN
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL_BY_NAME                                       'valid_email'
          1        SEND_VAL_EX                                              'hhh%40qq.com'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   28     4      > RETURN                                                   1

Function valid_email:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 21
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 64
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 50
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 52
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 60
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
2 jumps found. (Code = 44) Position 1 = 64, Position 2 = 52
Branch analysis from position: 64
Branch analysis from position: 52
Branch analysis from position: 64
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 29
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 21
Branch analysis from position: 33
Branch analysis from position: 21
filename:       /in/FARvN
function name:  valid_email
number of ops:  66
compiled vars:  !0 = $email, !1 = $email_array, !2 = $local_array, !3 = $i, !4 = $domain_array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5E%5B%5E%40%5D%7B1%2C64%7D%40%5B%5E%40%5D%7B1%2C255%7D%24%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        BOOL_NOT                                         ~6      $5
          6      > JMPZ                                                     ~6, ->8
    6     7    > > RETURN                                                   <false>
    8     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%40'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !1, $7
    9    13        INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 '.'
         15        FETCH_DIM_R                                      ~9      !1, 0
         16        SEND_VAL                                                 ~9
         17        DO_ICALL                                         $10     
         18        ASSIGN                                                   !2, $10
   10    19        ASSIGN                                                   !3, 0
         20      > JMP                                                      ->30
   11    21    >   INIT_FCALL                                               'preg_match'
         22        SEND_VAL                                                 '%2F%5E%28%28%5BA-Za-z0-9%21%23%24%25%26%27%2A%2B%5C%2F%3D%3F%5E_%60%7B%7C%7D%7E-%5D%5BA-Za-z0-9%21%23%24%25%26%27%2A%2B%5C%2F%3D%3F%5E_%60%7B%7C%7D%7E%5C.-%5D%7B0%2C63%7D%29%7C%28%22%5B%5E%28%5C%7C%22%29%5D%7B0%2C62%7D%22%29%29%24%2F'
         23        FETCH_DIM_R                                      ~13     !2, !3
         24        SEND_VAL                                                 ~13
         25        DO_ICALL                                         $14     
         26        BOOL_NOT                                         ~15     $14
         27      > JMPZ                                                     ~15, ->29
   12    28    > > RETURN                                                   <false>
   10    29    >   PRE_INC                                                  !3
         30    >   COUNT                                            ~17     !2
         31        IS_SMALLER                                               !3, ~17
         32      > JMPNZ                                                    ~18, ->21
   15    33    >   INIT_FCALL                                               'preg_match'
         34        SEND_VAL                                                 '%2F%5E%5C%5B%3F%5B0-9%5C.%5D%2B%5C%5D%3F%24%2F'
         35        FETCH_DIM_R                                      ~19     !1, 1
         36        SEND_VAL                                                 ~19
         37        DO_ICALL                                         $20     
         38        BOOL_NOT                                         ~21     $20
         39      > JMPZ                                                     ~21, ->64
   17    40    >   INIT_FCALL                                               'explode'
         41        SEND_VAL                                                 '.'
         42        FETCH_DIM_R                                      ~22     !1, 1
         43        SEND_VAL                                                 ~22
         44        DO_ICALL                                         $23     
         45        ASSIGN                                                   !4, $23
   18    46        COUNT                                            ~25     !4
         47        IS_SMALLER                                               ~25, 2
         48      > JMPZ                                                     ~26, ->50
   19    49    > > RETURN                                                   <false>
   21    50    >   ASSIGN                                                   !3, 0
         51      > JMP                                                      ->61
   22    52    >   INIT_FCALL                                               'preg_match'
         53        SEND_VAL                                                 '%2F%5E%28%28%5BA-Za-z0-9%5D%5BA-Za-z0-9-%5D%7B0%2C61%7D%5BA-Za-z0-9%5D%29%7C%28%5BA-Za-z0-9%5D%2B%29%29%24%2F'
         54        FETCH_DIM_R                                      ~28     !4, !3
         55        SEND_VAL                                                 ~28
         56        DO_ICALL                                         $29     
         57        BOOL_NOT                                         ~30     $29
         58      > JMPZ                                                     ~30, ->60
   23    59    > > RETURN                                                   <false>
   21    60    >   PRE_INC                                                  !3
         61    >   COUNT                                            ~32     !4
         62        IS_SMALLER                                               !3, ~32
         63      > JMPNZ                                                    ~33, ->52
   27    64    > > RETURN                                                   <true>
   28    65*     > RETURN                                                   null

End of function valid_email

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.27 ms | 1404 KiB | 17 Q