3v4l.org

run code in 300+ PHP versions simultaneously
<?php //define the receiver of the email $to = 'bibui@mines.edu'; //define the subject of the email $subject = 'Test HTML email'; //create a boundary string. It must be unique //so we use the MD5 algorithm to generate a random hash $random_hash = md5(date('r', time())); //define the headers we want passed. Note that they are separated with \r\n $headers = "From: aab@gmail.com\r\nReply-To: aab@gmail.com"; //add boundary string and mime type specification $headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\""; //define the body of the message. ob_start(); //Turn on output buffering ?> --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hello World!!! This is simple text email message. --PHP-alt-<?php echo $random_hash; ?> Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: 7bit <h2>Hello World!</h2> <p>This is something with <b>HTML</b> formatting.</p> --PHP-alt-<?php echo $random_hash; ?>-- <? //copy current buffer contents into $message variable and delete current output buffer $message = ob_get_clean(); //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 40
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 41
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/n6tdg
function name:  (null)
number of ops:  43
compiled vars:  !0 = $to, !1 = $subject, !2 = $random_hash, !3 = $headers, !4 = $message, !5 = $mail_sent
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'bibui%40mines.edu'
    5     1        ASSIGN                                                   !1, 'Test+HTML+email'
    8     2        INIT_FCALL                                               'md5'
          3        INIT_FCALL                                               'date'
          4        SEND_VAL                                                 'r'
          5        INIT_FCALL                                               'time'
          6        DO_ICALL                                         $8      
          7        SEND_VAR                                                 $8
          8        DO_ICALL                                         $9      
          9        SEND_VAR                                                 $9
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !2, $10
   10    12        ASSIGN                                                   !3, 'From%3A+aab%40gmail.com%0D%0AReply-To%3A+aab%40gmail.com'
   12    13        CONCAT                                           ~13     '%0D%0AContent-Type%3A+multipart%2Falternative%3B+boundary%3D%22PHP-alt-', !2
         14        CONCAT                                           ~14     ~13, '%22'
         15        ASSIGN_OP                                     8          !3, ~14
   14    16        INIT_FCALL                                               'ob_start'
         17        DO_ICALL                                                 
   16    18        ECHO                                                     '--PHP-alt-'
         19        ECHO                                                     !2
         20        ECHO                                                     '++%0AContent-Type%3A+text%2Fplain%3B+charset%3D%22iso-8859-1%22+%0AContent-Transfer-Encoding%3A+7bit%0A%0AHello+World%21%21%21+%0AThis+is+simple+text+email+message.+%0A%0A--PHP-alt-'
   23    21        ECHO                                                     !2
         22        ECHO                                                     '++%0AContent-Type%3A+text%2Fhtml%3B+charset%3D%22iso-8859-1%22+%0AContent-Transfer-Encoding%3A+7bit%0A%0A%3Ch2%3EHello+World%21%3C%2Fh2%3E%0A%3Cp%3EThis+is+something+with+%3Cb%3EHTML%3C%2Fb%3E+formatting.%3C%2Fp%3E+%0A%0A--PHP-alt-'
   30    23        ECHO                                                     !2
         24        ECHO                                                     '--%0A'
   33    25        INIT_FCALL                                               'ob_get_clean'
         26        DO_ICALL                                         $17     
         27        ASSIGN                                                   !4, $17
   35    28        BEGIN_SILENCE                                    ~19     
         29        INIT_FCALL                                               'mail'
         30        SEND_VAR                                                 !0
         31        SEND_VAR                                                 !1
         32        SEND_VAR                                                 !4
         33        SEND_VAR                                                 !3
         34        DO_ICALL                                         $20     
         35        END_SILENCE                                              ~19
         36        ASSIGN                                                   !5, $20
   37    37      > JMPZ                                                     !5, ->40
         38    >   QM_ASSIGN                                        ~22     'Mail+sent'
         39      > JMP                                                      ->41
         40    >   QM_ASSIGN                                        ~22     'Mail+failed'
         41    >   ECHO                                                     ~22
   38    42      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.68 ms | 1400 KiB | 25 Q