3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $_POST['email'] = 'test@mail.com'; $_POST['emailrepeat'] = 'test@gmail.com'; function cleanInput($input){ if(isset($_POST[$input])){ $input = $_POST[$input]; }else{ return false; } $input = htmlspecialchars($input); $input = trim($input); $input = stripslashes($input); return $input; } function isCorrectLength($input,$min,$max){ $x = mb_strlen($input); return ($x >= $min && $x <= $max); } if($email = cleanInput('email')){ if(filter_var($email, FILTER_VALIDATE_EMAIL)){ if(isCorrectLength($email,1,60)){ if(!$auth->isEmailTaken($email)){ $email_clean = $email; }else{ array_push($errorMessages,'Your email is already registered'); } }else{ array_push($errorMessage,'Your email is too long'); } }else{ array_push($errorMessages,'You entered an incorrect email'); } }else{ array_push($errorMessages,'You did not input an email'); } if($emailrepeat = cleanInput('emailrepeat')){ if(strcasecmp($email_clean, emailrepeat) != 0){ echo "$emailrepeat<br>$email_clean<br>"; array_push($errorMessages,'Your emails did not match'); } }else{ array_push($errorMessages,'You did not repeat your email'); }
based on QQCiC
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 13, Position 2 = 46
Branch analysis from position: 13
Jump found. Position 1 = 18, Position 2 = 41
Branch analysis from position: 18
Jump found. Position 1 = 24, Position 2 = 36
Branch analysis from position: 24
Jump found. Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
Jump found. Position 1 = 35
Branch analysis from position: 35
Jump found. Position 1 = 40
Branch analysis from position: 40
Jump found. Position 1 = 45
Branch analysis from position: 45
Jump found. Position 1 = 50
Branch analysis from position: 50
Jump found. Position 1 = 55, Position 2 = 72
Branch analysis from position: 55
Jump found. Position 1 = 62, Position 2 = 71
Branch analysis from position: 62
Jump found. Position 1 = 76
Branch analysis from position: 76
Jump found. Position 1 = -2
Branch analysis from position: 71
Branch analysis from position: 72
Jump found. Position 1 = -2
Branch analysis from position: 31
Jump found. Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 36
Jump found. Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 41
Jump found. Position 1 = 50
Branch analysis from position: 50
Branch analysis from position: 46
Jump found. Position 1 = 55, Position 2 = 72
Branch analysis from position: 55
Branch analysis from position: 72
filename:       /in/Hv9hN
function name:  (null)
number of ops:  77
compiled vars:  !0 = $email, !1 = $auth, !2 = $email_clean, !3 = $errorMessages, !4 = $errorMessage, !5 = $emailrepeat
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   FETCH_W                      global              $6      '_POST'
         1        ASSIGN_DIM                                               $6, 'email'
         2        OP_DATA                                                  'test%40mail.com'
   4     3        FETCH_W                      global              $8      '_POST'
         4        ASSIGN_DIM                                               $8, 'emailrepeat'
         5        OP_DATA                                                  'test%40gmail.com'
   6     6        NOP                                                      
  18     7        NOP                                                      
  23     8        INIT_FCALL                                               'cleaninput'
         9        SEND_VAL                                                 'email'
        10        DO_FCALL                                      0  $10     
        11        ASSIGN                                           $11     !0, $10
        12      > JMPZ                                                     $11, ->46
  24    13    >   INIT_FCALL                                               'filter_var'
        14        SEND_VAR                                                 !0
        15        SEND_VAL                                                 274
        16        DO_ICALL                                         $12     
        17      > JMPZ                                                     $12, ->41
  25    18    >   INIT_FCALL                                               'iscorrectlength'
        19        SEND_VAR                                                 !0
        20        SEND_VAL                                                 1
        21        SEND_VAL                                                 60
        22        DO_FCALL                                      0  $13     
        23      > JMPZ                                                     $13, ->36
  26    24    >   INIT_METHOD_CALL                                         !1, 'isEmailTaken'
        25        SEND_VAR_EX                                              !0
        26        DO_FCALL                                      0  $14     
        27        BOOL_NOT                                         ~15     $14
        28      > JMPZ                                                     ~15, ->31
  27    29    >   ASSIGN                                                   !2, !0
        30      > JMP                                                      ->35
  29    31    >   INIT_FCALL                                               'array_push'
        32        SEND_REF                                                 !3
        33        SEND_VAL                                                 'Your+email+is+already+registered'
        34        DO_ICALL                                                 
        35    > > JMP                                                      ->40
  32    36    >   INIT_FCALL                                               'array_push'
        37        SEND_REF                                                 !4
        38        SEND_VAL                                                 'Your+email+is+too+long'
        39        DO_ICALL                                                 
        40    > > JMP                                                      ->45
  35    41    >   INIT_FCALL                                               'array_push'
        42        SEND_REF                                                 !3
        43        SEND_VAL                                                 'You+entered+an+incorrect+email'
        44        DO_ICALL                                                 
        45    > > JMP                                                      ->50
  38    46    >   INIT_FCALL                                               'array_push'
        47        SEND_REF                                                 !3
        48        SEND_VAL                                                 'You+did+not+input+an+email'
        49        DO_ICALL                                                 
  40    50    >   INIT_FCALL                                               'cleaninput'
        51        SEND_VAL                                                 'emailrepeat'
        52        DO_FCALL                                      0  $21     
        53        ASSIGN                                           $22     !5, $21
        54      > JMPZ                                                     $22, ->72
  41    55    >   INIT_FCALL                                               'strcasecmp'
        56        SEND_VAR                                                 !2
        57        FETCH_CONSTANT                                   ~23     'emailrepeat'
        58        SEND_VAL                                                 ~23
        59        DO_ICALL                                         $24     
        60        IS_NOT_EQUAL                                     ~25     $24, 0
        61      > JMPZ                                                     ~25, ->71
  42    62    >   ROPE_INIT                                     4  ~27     !5
        63        ROPE_ADD                                      1  ~27     ~27, '%3Cbr%3E'
        64        ROPE_ADD                                      2  ~27     ~27, !2
        65        ROPE_END                                      3  ~26     ~27, '%3Cbr%3E'
        66        ECHO                                                     ~26
  43    67        INIT_FCALL                                               'array_push'
        68        SEND_REF                                                 !3
        69        SEND_VAL                                                 'Your+emails+did+not+match'
        70        DO_ICALL                                                 
        71    > > JMP                                                      ->76
  46    72    >   INIT_FCALL                                               'array_push'
        73        SEND_REF                                                 !3
        74        SEND_VAL                                                 'You+did+not+repeat+your+email'
        75        DO_ICALL                                                 
        76    > > RETURN                                                   1

Function cleaninput:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
Jump found. Position 1 = 9
Branch analysis from position: 9
Jump found. Position 1 = -2
Branch analysis from position: 8
Jump found. Position 1 = -2
filename:       /in/Hv9hN
function name:  cleanInput
number of ops:  23
compiled vars:  !0 = $input
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   6     0  E >   RECV                                             !0      
   7     1        FETCH_IS                                         $1      '_POST'
         2        ISSET_ISEMPTY_DIM_OBJ                       33554432  ~2      $1, !0
         3      > JMPZ                                                     ~2, ->8
   8     4    >   FETCH_R                      global              $3      '_POST'
         5        FETCH_DIM_R                                      $4      $3, !0
         6        ASSIGN                                                   !0, $4
         7      > JMP                                                      ->9
  10     8    > > RETURN                                                   <false>
  12     9    >   INIT_FCALL                                               'htmlspecialchars'
        10        SEND_VAR                                                 !0
        11        DO_ICALL                                         $6      
        12        ASSIGN                                                   !0, $6
  13    13        INIT_FCALL                                               'trim'
        14        SEND_VAR                                                 !0
        15        DO_ICALL                                         $8      
        16        ASSIGN                                                   !0, $8
  14    17        INIT_FCALL                                               'stripslashes'
        18        SEND_VAR                                                 !0
        19        DO_ICALL                                         $10     
        20        ASSIGN                                                   !0, $10
  15    21      > RETURN                                                   !0
  16    22*     > RETURN                                                   null

End of function cleaninput

Function iscorrectlength:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
Jump found. Position 1 = -2
Branch analysis from position: 11
filename:       /in/Hv9hN
function name:  isCorrectLength
number of ops:  13
compiled vars:  !0 = $input, !1 = $min, !2 = $max, !3 = $x
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  18     0  E >   RECV                                             !0      
         1        RECV                                             !1      
         2        RECV                                             !2      
  19     3        INIT_FCALL                                               'mb_strlen'
         4        SEND_VAR                                                 !0
         5        DO_ICALL                                         $4      
         6        ASSIGN                                                   !3, $4
  20     7        IS_SMALLER_OR_EQUAL                              ~6      !1, !3
         8      > JMPZ_EX                                          ~6      ~6, ->11
         9    >   IS_SMALLER_OR_EQUAL                              ~7      !3, !2
        10        BOOL                                             ~6      ~7
        11    > > RETURN                                                   ~6
  21    12*     > RETURN                                                   null

End of function iscorrectlength

Generated using Vulcan Logic Dumper, using php 7.3.0