3v4l.org

run code in 300+ PHP versions simultaneously
<?php function checkEmail($email) { return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email); } function checkEmail2($email) { return (bool)preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/", $email); } if (function_exists('eregi')){ echo "eregi:\n"; var_dump(checkEmail("jim@example.com")); var_dump(checkEmail("jim@example.comm")); } echo "preg_match:\n"; var_dump(checkEmail2("jim@example.com")); var_dump(checkEmail2("jim@example.comm"));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/tdtuY
function name:  (null)
number of ops:  31
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'function_exists'
          1        SEND_VAL                                                 'eregi'
          2        DO_ICALL                                         $0      
          3      > JMPZ                                                     $0, ->17
   14     4    >   ECHO                                                     'eregi%3A%0A'
   15     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'checkemail'
          7        SEND_VAL                                                 'jim%40example.com'
          8        DO_FCALL                                      0  $1      
          9        SEND_VAR                                                 $1
         10        DO_ICALL                                                 
   16    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'checkemail'
         13        SEND_VAL                                                 'jim%40example.comm'
         14        DO_FCALL                                      0  $3      
         15        SEND_VAR                                                 $3
         16        DO_ICALL                                                 
   18    17    >   ECHO                                                     'preg_match%3A%0A'
   19    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'checkemail2'
         20        SEND_VAL                                                 'jim%40example.com'
         21        DO_FCALL                                      0  $5      
         22        SEND_VAR                                                 $5
         23        DO_ICALL                                                 
   20    24        INIT_FCALL                                               'var_dump'
         25        INIT_FCALL                                               'checkemail2'
         26        SEND_VAL                                                 'jim%40example.comm'
         27        DO_FCALL                                      0  $7      
         28        SEND_VAR                                                 $7
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Function checkemail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tdtuY
function name:  checkEmail
number of ops:  7
compiled vars:  !0 = $email
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL_BY_NAME                                       'eregi'
          2        SEND_VAL_EX                                              '%5E%5B_a-z0-9-%5D%2B%28%5C.%5B_a-z0-9-%5D%2B%29%2A%40%5Ba-z0-9-%5D%2B%28%5C.%5Ba-z0-9-%5D%2B%29%2A%28%5C.%5Ba-z%5D%7B2%2C3%7D%29%24'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0  $1      
          5      > RETURN                                                   $1
    5     6*     > RETURN                                                   null

End of function checkemail

Function checkemail2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tdtuY
function name:  checkEmail2
number of ops:  8
compiled vars:  !0 = $email
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5E%5B_a-z0-9-%5D%2B%28%5C.%5B_a-z0-9-%5D%2B%29%2A%40%5Ba-z0-9-%5D%2B%28%5C.%5Ba-z0-9-%5D%2B%29%2A%28%5C.%5Ba-z%5D%7B2%2C3%7D%29%24%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        BOOL                                             ~2      $1
          6      > RETURN                                                   ~2
    9     7*     > RETURN                                                   null

End of function checkemail2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.64 ms | 1403 KiB | 23 Q