3v4l.org

run code in 300+ PHP versions simultaneously
<?php $name = "foo"; $email = "foo@bar.com"; $message = "test"; // Get the form fields and remove whitespace. $name = strip_tags(trim($name)); $name = str_replace(array("\r","\n"),array(" "," "),$name); $email = filter_var(trim($email), FILTER_SANITIZE_EMAIL); $message = trim($message); // Check that data was sent to the mailer. if ( empty($name) OR empty($message) OR !filter_var($email, FILTER_VALIDATE_EMAIL)) { // Set a 400 (bad request) response code and exit. http_response_code(400); echo "Oops! There was a problem with your submission. Please complete the form and try again."; exit; } // Set the recipient email address. // FIXME: Update this to your desired email address. $recipient = "mail@mail.com"; // Set the email subject. $subject = "New contact from $name"; // Build the email content. $email_content = "Name: $name\n"; $email_content .= "Email: $email\n\n"; $email_content .= "Message:\n$message\n"; // Build the email headers. $email_headers = "From: $name <$email>"; // Send the email. if (mail($recipient, $subject, $email_content, $email_headers)) { // Set a 200 (okay) response code. http_response_code(200); echo "Thank You! Your message has been sent."; } else { // Set a 500 (internal server error) response code. http_response_code(500); echo "Oops! Something went wrong and we couldn't send your message."; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
2 jumps found. (Code = 47) Position 1 = 33, Position 2 = 39
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 45
Branch analysis from position: 40
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 45
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 79
Branch analysis from position: 74
1 jumps found. (Code = 42) Position 1 = 83
Branch analysis from position: 83
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
Branch analysis from position: 32
filename:       /in/fus4T
function name:  (null)
number of ops:  84
compiled vars:  !0 = $name, !1 = $email, !2 = $message, !3 = $recipient, !4 = $subject, !5 = $email_content, !6 = $email_headers
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'foo'
    3     1        ASSIGN                                                   !1, 'foo%40bar.com'
    4     2        ASSIGN                                                   !2, 'test'
    6     3        INIT_FCALL                                               'strip_tags'
          4        INIT_FCALL                                               'trim'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $10     
          7        SEND_VAR                                                 $10
          8        DO_ICALL                                         $11     
          9        ASSIGN                                                   !0, $11
    7    10        INIT_FCALL                                               'str_replace'
         11        SEND_VAL                                                 <array>
         12        SEND_VAL                                                 <array>
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $13     
         15        ASSIGN                                                   !0, $13
    8    16        INIT_FCALL                                               'filter_var'
         17        INIT_FCALL                                               'trim'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                         $15     
         20        SEND_VAR                                                 $15
         21        SEND_VAL                                                 517
         22        DO_ICALL                                         $16     
         23        ASSIGN                                                   !1, $16
    9    24        INIT_FCALL                                               'trim'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $18     
         27        ASSIGN                                                   !2, $18
   12    28        ISSET_ISEMPTY_CV                                 ~20     !0
         29      > JMPNZ_EX                                         ~20     ~20, ->32
         30    >   ISSET_ISEMPTY_CV                                 ~21     !2
         31        BOOL                                             ~20     ~21
         32    > > JMPNZ_EX                                         ~20     ~20, ->39
         33    >   INIT_FCALL                                               'filter_var'
         34        SEND_VAR                                                 !1
         35        SEND_VAL                                                 274
         36        DO_ICALL                                         $22     
         37        BOOL_NOT                                         ~23     $22
         38        BOOL                                             ~20     ~23
         39    > > JMPZ                                                     ~20, ->45
   14    40    >   INIT_FCALL                                               'http_response_code'
         41        SEND_VAL                                                 400
         42        DO_ICALL                                                 
   15    43        ECHO                                                     'Oops%21+There+was+a+problem+with+your+submission.+Please+complete+the+form+and+try+again.'
   16    44      > EXIT                                                     
   21    45    >   ASSIGN                                                   !3, 'mail%40mail.com'
   24    46        NOP                                                      
         47        FAST_CONCAT                                      ~26     'New+contact+from+', !0
         48        ASSIGN                                                   !4, ~26
   27    49        ROPE_INIT                                     3  ~29     'Name%3A+'
         50        ROPE_ADD                                      1  ~29     ~29, !0
         51        ROPE_END                                      2  ~28     ~29, '%0A'
         52        ASSIGN                                                   !5, ~28
   28    53        ROPE_INIT                                     3  ~33     'Email%3A+'
         54        ROPE_ADD                                      1  ~33     ~33, !1
         55        ROPE_END                                      2  ~32     ~33, '%0A%0A'
         56        ASSIGN_OP                                     8          !5, ~32
   29    57        ROPE_INIT                                     3  ~37     'Message%3A%0A'
         58        ROPE_ADD                                      1  ~37     ~37, !2
         59        ROPE_END                                      2  ~36     ~37, '%0A'
         60        ASSIGN_OP                                     8          !5, ~36
   32    61        ROPE_INIT                                     5  ~41     'From%3A+'
         62        ROPE_ADD                                      1  ~41     ~41, !0
         63        ROPE_ADD                                      2  ~41     ~41, '+%3C'
         64        ROPE_ADD                                      3  ~41     ~41, !1
         65        ROPE_END                                      4  ~40     ~41, '%3E'
         66        ASSIGN                                                   !6, ~40
   35    67        INIT_FCALL                                               'mail'
         68        SEND_VAR                                                 !3
         69        SEND_VAR                                                 !4
         70        SEND_VAR                                                 !5
         71        SEND_VAR                                                 !6
         72        DO_ICALL                                         $45     
         73      > JMPZ                                                     $45, ->79
   37    74    >   INIT_FCALL                                               'http_response_code'
         75        SEND_VAL                                                 200
         76        DO_ICALL                                                 
   38    77        ECHO                                                     'Thank+You%21+Your+message+has+been+sent.'
         78      > JMP                                                      ->83
   41    79    >   INIT_FCALL                                               'http_response_code'
         80        SEND_VAL                                                 500
         81        DO_ICALL                                                 
   42    82        ECHO                                                     'Oops%21+Something+went+wrong+and+we+couldn%27t+send+your+message.'
   46    83    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.69 ms | 1404 KiB | 25 Q