3v4l.org

run code in 300+ PHP versions simultaneously
<?php // define variables and set to empty values $nameErr = $emailErr = $genderErr = $websiteErr = ""; $name = $email = $gender = $comment = $website = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["name"])) {$nameErr = "Name is required";} else { $name = test_input($_POST["name"]); // check if name only contains letters and whitespace if (!preg_match("/^[a-zA-Z ]*$/",$name)) { $nameErr = "Only letters and white space allowed"; } } if (empty($_POST["email"])) {$emailErr = "Email is required";} else { $email = test_input($_POST["email"]); // check if e-mail address syntax is valid if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$email)) { $emailErr = "Invalid email format"; } } if (empty($_POST["website"])) {$website = "";} else { $website = test_input($_POST["website"]); // check if URL address syntax is valid (this regular expression also allows dashes in the URL) if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$website)) { $websiteErr = "Invalid URL"; } } if (empty($_POST["comment"])) {$comment = "";} else {$comment = test_input($_POST["comment"]);} if (empty($_POST["gender"])) {$genderErr = "Gender is required";} else {$gender = test_input($_POST["gender"]);} } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 94
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 51
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 70
Branch analysis from position: 70
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 75
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 82
Branch analysis from position: 82
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 87
Branch analysis from position: 85
1 jumps found. (Code = 42) Position 1 = 94
Branch analysis from position: 94
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 87
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 75
2 jumps found. (Code = 43) Position 1 = 85, Position 2 = 87
Branch analysis from position: 85
Branch analysis from position: 87
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 69, Position 2 = 70
Branch analysis from position: 69
2 jumps found. (Code = 43) Position 1 = 73, Position 2 = 75
Branch analysis from position: 73
Branch analysis from position: 75
Branch analysis from position: 70
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 51
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 54, Position 2 = 56
Branch analysis from position: 54
Branch analysis from position: 56
Branch analysis from position: 51
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 32
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
Branch analysis from position: 37
Branch analysis from position: 32
Branch analysis from position: 94
filename:       /in/et8Fi
function name:  (null)
number of ops:  95
compiled vars:  !0 = $nameErr, !1 = $emailErr, !2 = $genderErr, !3 = $websiteErr, !4 = $name, !5 = $email, !6 = $gender, !7 = $comment, !8 = $website
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                           ~9      !3, ''
          1        ASSIGN                                           ~10     !2, ~9
          2        ASSIGN                                           ~11     !1, ~10
          3        ASSIGN                                                   !0, ~11
    4     4        ASSIGN                                           ~13     !8, ''
          5        ASSIGN                                           ~14     !7, ~13
          6        ASSIGN                                           ~15     !6, ~14
          7        ASSIGN                                           ~16     !5, ~15
          8        ASSIGN                                                   !4, ~16
    6     9        FETCH_R                      global              ~18     '_SERVER'
         10        FETCH_DIM_R                                      ~19     ~18, 'REQUEST_METHOD'
         11        IS_EQUAL                                                 ~19, 'POST'
         12      > JMPZ                                                     ~20, ->94
    8    13    >   FETCH_IS                                         ~21     '_POST'
         14        ISSET_ISEMPTY_DIM_OBJ                         1          ~21, 'name'
         15      > JMPZ                                                     ~22, ->18
    9    16    >   ASSIGN                                                   !0, 'Name+is+required'
         17      > JMP                                                      ->32
   12    18    >   INIT_FCALL_BY_NAME                                       'test_input'
         19        CHECK_FUNC_ARG                                           
         20        FETCH_FUNC_ARG               global              $24     '_POST'
         21        FETCH_DIM_FUNC_ARG                               $25     $24, 'name'
         22        SEND_FUNC_ARG                                            $25
         23        DO_FCALL                                      0  $26     
         24        ASSIGN                                                   !4, $26
   14    25        INIT_FCALL                                               'preg_match'
         26        SEND_VAL                                                 '%2F%5E%5Ba-zA-Z+%5D%2A%24%2F'
         27        SEND_VAR                                                 !4
         28        DO_ICALL                                         $28     
         29        BOOL_NOT                                         ~29     $28
         30      > JMPZ                                                     ~29, ->32
   16    31    >   ASSIGN                                                   !0, 'Only+letters+and+white+space+allowed'
   20    32    >   FETCH_IS                                         ~31     '_POST'
         33        ISSET_ISEMPTY_DIM_OBJ                         1          ~31, 'email'
         34      > JMPZ                                                     ~32, ->37
   21    35    >   ASSIGN                                                   !1, 'Email+is+required'
         36      > JMP                                                      ->51
   24    37    >   INIT_FCALL_BY_NAME                                       'test_input'
         38        CHECK_FUNC_ARG                                           
         39        FETCH_FUNC_ARG               global              $34     '_POST'
         40        FETCH_DIM_FUNC_ARG                               $35     $34, 'email'
         41        SEND_FUNC_ARG                                            $35
         42        DO_FCALL                                      0  $36     
         43        ASSIGN                                                   !5, $36
   26    44        INIT_FCALL                                               'preg_match'
         45        SEND_VAL                                                 '%2F%28%5B%5Cw%5C-%5D%2B%5C%40%5B%5Cw%5C-%5D%2B%5C.%5B%5Cw%5C-%5D%2B%29%2F'
         46        SEND_VAR                                                 !5
         47        DO_ICALL                                         $38     
         48        BOOL_NOT                                         ~39     $38
         49      > JMPZ                                                     ~39, ->51
   28    50    >   ASSIGN                                                   !1, 'Invalid+email+format'
   32    51    >   FETCH_IS                                         ~41     '_POST'
         52        ISSET_ISEMPTY_DIM_OBJ                         1          ~41, 'website'
         53      > JMPZ                                                     ~42, ->56
   33    54    >   ASSIGN                                                   !8, ''
         55      > JMP                                                      ->70
   36    56    >   INIT_FCALL_BY_NAME                                       'test_input'
         57        CHECK_FUNC_ARG                                           
         58        FETCH_FUNC_ARG               global              $44     '_POST'
         59        FETCH_DIM_FUNC_ARG                               $45     $44, 'website'
         60        SEND_FUNC_ARG                                            $45
         61        DO_FCALL                                      0  $46     
         62        ASSIGN                                                   !8, $46
   38    63        INIT_FCALL                                               'preg_match'
         64        SEND_VAL                                                 '%2F%5Cb%28%3F%3A%28%3F%3Ahttps%3F%7Cftp%29%3A%5C%2F%5C%2F%7Cwww%5C.%29%5B-a-z0-9%2B%26%40%23%5C%2F%25%3F%3D%7E_%7C%21%3A%2C.%3B%5D%2A%5B-a-z0-9%2B%26%40%23%5C%2F%25%3D%7E_%7C%5D%2Fi'
         65        SEND_VAR                                                 !8
         66        DO_ICALL                                         $48     
         67        BOOL_NOT                                         ~49     $48
         68      > JMPZ                                                     ~49, ->70
   40    69    >   ASSIGN                                                   !3, 'Invalid+URL'
   44    70    >   FETCH_IS                                         ~51     '_POST'
         71        ISSET_ISEMPTY_DIM_OBJ                         1          ~51, 'comment'
         72      > JMPZ                                                     ~52, ->75
   45    73    >   ASSIGN                                                   !7, ''
         74      > JMP                                                      ->82
   47    75    >   INIT_FCALL_BY_NAME                                       'test_input'
         76        CHECK_FUNC_ARG                                           
         77        FETCH_FUNC_ARG               global              $54     '_POST'
         78        FETCH_DIM_FUNC_ARG                               $55     $54, 'comment'
         79        SEND_FUNC_ARG                                            $55
         80        DO_FCALL                                      0  $56     
         81        ASSIGN                                                   !7, $56
   49    82    >   FETCH_IS                                         ~58     '_POST'
         83        ISSET_ISEMPTY_DIM_OBJ                         1          ~58, 'gender'
         84      > JMPZ                                                     ~59, ->87
   50    85    >   ASSIGN                                                   !2, 'Gender+is+required'
         86      > JMP                                                      ->94
   52    87    >   INIT_FCALL_BY_NAME                                       'test_input'
         88        CHECK_FUNC_ARG                                           
         89        FETCH_FUNC_ARG               global              $61     '_POST'
         90        FETCH_DIM_FUNC_ARG                               $62     $61, 'gender'
         91        SEND_FUNC_ARG                                            $62
         92        DO_FCALL                                      0  $63     
         93        ASSIGN                                                   !6, $63
   54    94    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.09 ms | 1404 KiB | 15 Q