3v4l.org

run code in 300+ PHP versions simultaneously
<?php // get all form values $input['Contact name'] = $_POST['contact_name'] ?? ''; $input['Firm name'] = $_POST['firm_name'] ?? ''; $input['Email'] = $_POST['email'] ?? ''; $input['Job number'] = $_POST['job_number'] ?? ''; $input['Document'] = $_POST['document'] ?? ''; $input['Discount'] = $_POST['discount'] ?? ''; $input['Message'] = $_POST['message'] ?? ''; // generate the email content (i.e. each line is like "Contact name: Mark") $formContent = ''; foreach($input as $key => $value) { $formContent .= $key . ": " . $value . "\n"; } $to = "my@email.com"; // TODO: replace this with your email address $subject = "Contact Form"; /* Note that this is likely part of the issue. Most email clients (gmail, outlook) will mark emails as spam if you try to send an email from an email address that your server isn't configured to send from. See https://stackoverflow.com/questions/17533863/how-to-configure-php-to-send-e-mail for more info. */ $mailheader = "From: " . $input['Email']; // for this example, output $formContent and end the script because mail() isn't allowed here var_dump($formContent); die(); mail($to, $subject, $formContent, $mailheader) or die('Error sending email'); // redirect to the thank you page // TODO: update this URL to be yours header('Location: http://www.example.com/thankyou.html'); exit;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 44, Position 2 = 51
Branch analysis from position: 44
2 jumps found. (Code = 78) Position 1 = 45, Position 2 = 51
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Branch analysis from position: 51
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 51
filename:       /in/WePRh
function name:  (null)
number of ops:  75
compiled vars:  !0 = $input, !1 = $formContent, !2 = $value, !3 = $key, !4 = $to, !5 = $subject, !6 = $mailheader
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_IS                                         ~8      '_POST'
          1        FETCH_DIM_IS                                     ~9      ~8, 'contact_name'
          2        COALESCE                                         ~10     ~9
          3        QM_ASSIGN                                        ~10     ''
          4        ASSIGN_DIM                                               !0, 'Contact+name'
          5        OP_DATA                                                  ~10
    5     6        FETCH_IS                                         ~12     '_POST'
          7        FETCH_DIM_IS                                     ~13     ~12, 'firm_name'
          8        COALESCE                                         ~14     ~13
          9        QM_ASSIGN                                        ~14     ''
         10        ASSIGN_DIM                                               !0, 'Firm+name'
         11        OP_DATA                                                  ~14
    6    12        FETCH_IS                                         ~16     '_POST'
         13        FETCH_DIM_IS                                     ~17     ~16, 'email'
         14        COALESCE                                         ~18     ~17
         15        QM_ASSIGN                                        ~18     ''
         16        ASSIGN_DIM                                               !0, 'Email'
         17        OP_DATA                                                  ~18
    7    18        FETCH_IS                                         ~20     '_POST'
         19        FETCH_DIM_IS                                     ~21     ~20, 'job_number'
         20        COALESCE                                         ~22     ~21
         21        QM_ASSIGN                                        ~22     ''
         22        ASSIGN_DIM                                               !0, 'Job+number'
         23        OP_DATA                                                  ~22
    8    24        FETCH_IS                                         ~24     '_POST'
         25        FETCH_DIM_IS                                     ~25     ~24, 'document'
         26        COALESCE                                         ~26     ~25
         27        QM_ASSIGN                                        ~26     ''
         28        ASSIGN_DIM                                               !0, 'Document'
         29        OP_DATA                                                  ~26
    9    30        FETCH_IS                                         ~28     '_POST'
         31        FETCH_DIM_IS                                     ~29     ~28, 'discount'
         32        COALESCE                                         ~30     ~29
         33        QM_ASSIGN                                        ~30     ''
         34        ASSIGN_DIM                                               !0, 'Discount'
         35        OP_DATA                                                  ~30
   10    36        FETCH_IS                                         ~32     '_POST'
         37        FETCH_DIM_IS                                     ~33     ~32, 'message'
         38        COALESCE                                         ~34     ~33
         39        QM_ASSIGN                                        ~34     ''
         40        ASSIGN_DIM                                               !0, 'Message'
         41        OP_DATA                                                  ~34
   13    42        ASSIGN                                                   !1, ''
   14    43      > FE_RESET_R                                       $36     !0, ->51
         44    > > FE_FETCH_R                                       ~37     $36, !2, ->51
         45    >   ASSIGN                                                   !3, ~37
   15    46        CONCAT                                           ~39     !3, '%3A+'
         47        CONCAT                                           ~40     ~39, !2
         48        CONCAT                                           ~41     ~40, '%0A'
         49        ASSIGN_OP                                     8          !1, ~41
   14    50      > JMP                                                      ->44
         51    >   FE_FREE                                                  $36
   18    52        ASSIGN                                                   !4, 'my%40email.com'
   19    53        ASSIGN                                                   !5, 'Contact+Form'
   26    54        FETCH_DIM_R                                      ~45     !0, 'Email'
         55        CONCAT                                           ~46     'From%3A+', ~45
         56        ASSIGN                                                   !6, ~46
   29    57        INIT_FCALL                                               'var_dump'
         58        SEND_VAR                                                 !1
         59        DO_ICALL                                                 
   30    60      > EXIT                                                     
   32    61*       INIT_FCALL                                               'mail'
         62*       SEND_VAR                                                 !4
         63*       SEND_VAR                                                 !5
         64*       SEND_VAR                                                 !1
         65*       SEND_VAR                                                 !6
         66*       DO_ICALL                                         $49     
         67*       JMPNZ_EX                                         ~50     $49, ->70
         68*       EXIT                                                     'Error+sending+email'
         69*       BOOL                                             ~50     <true>
   36    70*       INIT_FCALL                                               'header'
         71*       SEND_VAL                                                 'Location%3A+http%3A%2F%2Fwww.example.com%2Fthankyou.html'
         72*       DO_ICALL                                                 
   38    73*       EXIT                                                     
   39    74*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.66 ms | 1005 KiB | 16 Q