3v4l.org

run code in 300+ PHP versions simultaneously
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Form</title> </head> <body> <?php function spamcheck($field) { // Sanitize e-mail address $field=filter_var($field, FILTER_SANITIZE_EMAIL); // Validate e-mail address if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } ?> <h2>Feedback Form</h2> <?php // display form if user has not clicked submit if (!isset($_POST["submit"])) { ?> <form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>"> From: <input type="text" name="from"><br> Subject: <input type="text" name="subject"><br> Message: <textarea rows="10" cols="40" name="message"></textarea><br> <input type="submit" name="submit" value="Submit Feedback"> </form> <?php } else { // the user has submitted the form // Check if the "from" input field is filled out if (isset($_POST["from"])) { // Check if "from" email address is valid $mailcheck = spamcheck($_POST["from"]); if ($mailcheck==FALSE) { echo "Invalid input"; } else { $from = $_POST["from"]; // sender $subject = $_POST["subject"]; $message = $_POST["message"]; // message lines should not exceed 70 characters (PHP rule), so wrap it $message = wordwrap($message, 70); // send mail mail("dan@deepbluedive.com",$subject,$message,"From: $from\n"); echo "Thank you for sending us feedback"; } } } ?> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 49
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
filename:       /in/BrpKe
function name:  (null)
number of ops:  51
compiled vars:  !0 = $mailcheck, !1 = $from, !2 = $subject, !3 = $message
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3C%21doctype+html%3E%0A%3Chtml+lang%3D%22en%22%3E%0A%3Chead%3E%0A%09%3Cmeta+charset%3D%22UTF-8%22%3E%0A%09%3Ctitle%3EForm%3C%2Ftitle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%0A%09'
   21     1        ECHO                                                     '%0A%09%3Ch2%3EFeedback+Form%3C%2Fh2%3E%0A%09'
   25     2        FETCH_IS                                         ~4      '_POST'
          3        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~4, 'submit'
          4        BOOL_NOT                                         ~6      ~5
          5      > JMPZ                                                     ~6, ->12
   27     6    >   ECHO                                                     '%09++%3Cform+method%3D%22post%22+action%3D%22'
          7        FETCH_R                      global              ~7      '_SERVER'
          8        FETCH_DIM_R                                      ~8      ~7, 'PHP_SELF'
          9        ECHO                                                     ~8
         10        ECHO                                                     '%22%3E%0A%09++From%3A+%3Cinput+type%3D%22text%22+name%3D%22from%22%3E%3Cbr%3E%0A%09++Subject%3A+%3Cinput+type%3D%22text%22+name%3D%22subject%22%3E%3Cbr%3E%0A%09++Message%3A+%3Ctextarea+rows%3D%2210%22+cols%3D%2240%22+name%3D%22message%22%3E%3C%2Ftextarea%3E%3Cbr%3E%0A%09++%3Cinput+type%3D%22submit%22+name%3D%22submit%22+value%3D%22Submit+Feedback%22%3E%0A%09++%3C%2Fform%3E%0A%09++'
         11      > JMP                                                      ->49
   36    12    >   FETCH_IS                                         ~9      '_POST'
         13        ISSET_ISEMPTY_DIM_OBJ                         0          ~9, 'from'
         14      > JMPZ                                                     ~10, ->49
   38    15    >   INIT_FCALL                                               'spamcheck'
         16        FETCH_R                      global              ~11     '_POST'
         17        FETCH_DIM_R                                      ~12     ~11, 'from'
         18        SEND_VAL                                                 ~12
         19        DO_FCALL                                      0  $13     
         20        ASSIGN                                                   !0, $13
   39    21        BOOL_NOT                                         ~15     !0
         22      > JMPZ                                                     ~15, ->25
   40    23    >   ECHO                                                     'Invalid+input'
         24      > JMP                                                      ->49
   42    25    >   FETCH_R                      global              ~16     '_POST'
         26        FETCH_DIM_R                                      ~17     ~16, 'from'
         27        ASSIGN                                                   !1, ~17
   43    28        FETCH_R                      global              ~19     '_POST'
         29        FETCH_DIM_R                                      ~20     ~19, 'subject'
         30        ASSIGN                                                   !2, ~20
   44    31        FETCH_R                      global              ~22     '_POST'
         32        FETCH_DIM_R                                      ~23     ~22, 'message'
         33        ASSIGN                                                   !3, ~23
   46    34        INIT_FCALL                                               'wordwrap'
         35        SEND_VAR                                                 !3
         36        SEND_VAL                                                 70
         37        DO_ICALL                                         $25     
         38        ASSIGN                                                   !3, $25
   48    39        INIT_FCALL                                               'mail'
         40        SEND_VAL                                                 'dan%40deepbluedive.com'
         41        SEND_VAR                                                 !2
         42        SEND_VAR                                                 !3
         43        ROPE_INIT                                     3  ~28     'From%3A+'
         44        ROPE_ADD                                      1  ~28     ~28, !1
         45        ROPE_END                                      2  ~27     ~28, '%0A'
         46        SEND_VAL                                                 ~27
         47        DO_ICALL                                                 
   49    48        ECHO                                                     'Thank+you+for+sending+us+feedback'
   54    49    >   ECHO                                                     '%09%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   56    50      > RETURN                                                   1

Function spamcheck:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BrpKe
function name:  spamcheck
number of ops:  15
compiled vars:  !0 = $field
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   12     1        INIT_FCALL                                               'filter_var'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 517
          4        DO_ICALL                                         $1      
          5        ASSIGN                                                   !0, $1
   14     6        INIT_FCALL                                               'filter_var'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 274
          9        DO_ICALL                                         $3      
         10      > JMPZ                                                     $3, ->13
   15    11    > > RETURN                                                   <true>
         12*       JMP                                                      ->14
   17    13    > > RETURN                                                   <false>
   19    14*     > RETURN                                                   null

End of function spamcheck

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.08 ms | 1403 KiB | 20 Q