3v4l.org

run code in 300+ PHP versions simultaneously
<?php $emi = $total_interest = $total_payment = ''; if ($_SERVER["REQUEST_METHOD"] == "POST") { $loan = floatval($_POST['loan']); $rate = floatval($_POST['rate']); $years = floatval($_POST['years']); if ($loan > 0 && $rate > 0 && $years > 0) { $months = $years * 12; $monthly_rate = $rate / (12 * 100); $emi = ($loan * $monthly_rate * pow(1 + $monthly_rate, $months)) / (pow(1 + $monthly_rate, $months) - 1); $total_payment = $emi * $months; $total_interest = $total_payment - $loan; } } ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>EMI Calculator</title> </head> <body style="font-family: Arial, sans-serif; background: #f5f5f5; margin: 20px;"> <div style="max-width: 500px; margin: auto; background: #fff; padding: 25px; border-radius: 12px; box-shadow: 0 0 15px rgba(0,0,0,0.1);"> <h2 style="color: #38ad2a; text-align: center;">💰 EMI Calculator</h2> <form method="post" action="" style="margin-top: 20px;"> <label style="display:block; margin-bottom: 10px;">Loan Amount (₹):</label> <input type="number" name="loan" step="0.01" required style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px; margin-bottom: 15px;"> <label style="display:block; margin-bottom: 10px;">Annual Interest Rate (%):</label> <input type="number" name="rate" step="0.01" required style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px; margin-bottom: 15px;"> <label style="display:block; margin-bottom: 10px;">Loan Term (Years):</label> <input type="number" name="years" required style="width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px; margin-bottom: 20px;"> <button type="submit" style="width: 100%; background-color: #38ad2a; color: #fff; padding: 12px; border: none; border-radius: 8px; font-size: 16px;">Calculate EMI</button> </form> <?php if ($emi): ?> <div style="margin-top: 30px; border-top: 1px solid #ccc; padding-top: 20px;"> <p style="color: black; font-weight: bold;">📅 Monthly EMI: <span style="color: green;">₹<?= number_format($emi, 2) ?></span></p> <p style="color: black; font-weight: bold;">💸 Total Interest Payable: <span style="color: red;">₹<?= number_format($total_interest, 2) ?></span></p> <p style="color: black; font-weight: bold;">🧾 Total Payment (Principal + Interest): <span style="color: #38ad2a;">₹<?= number_format($total_payment, 2) ?></span></p> </div> <?php endif; ?> </div> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 50
Branch analysis from position: 7
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 50
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 71
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 71
Branch analysis from position: 50
Branch analysis from position: 26
Branch analysis from position: 23
Branch analysis from position: 50
filename:       /in/sumb4
function name:  (null)
number of ops:  73
compiled vars:  !0 = $emi, !1 = $total_interest, !2 = $total_payment, !3 = $loan, !4 = $rate, !5 = $years, !6 = $months, !7 = $monthly_rate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                           ~8      !2, ''
          1        ASSIGN                                           ~9      !1, ~8
          2        ASSIGN                                                   !0, ~9
    4     3        FETCH_R                      global              ~11     '_SERVER'
          4        FETCH_DIM_R                                      ~12     ~11, 'REQUEST_METHOD'
          5        IS_EQUAL                                                 ~12, 'POST'
          6      > JMPZ                                                     ~13, ->50
    5     7    >   FETCH_R                      global              ~14     '_POST'
          8        FETCH_DIM_R                                      ~15     ~14, 'loan'
          9        CAST                                          5  ~16     ~15
         10        ASSIGN                                                   !3, ~16
    6    11        FETCH_R                      global              ~18     '_POST'
         12        FETCH_DIM_R                                      ~19     ~18, 'rate'
         13        CAST                                          5  ~20     ~19
         14        ASSIGN                                                   !4, ~20
    7    15        FETCH_R                      global              ~22     '_POST'
         16        FETCH_DIM_R                                      ~23     ~22, 'years'
         17        CAST                                          5  ~24     ~23
         18        ASSIGN                                                   !5, ~24
    9    19        IS_SMALLER                                       ~26     0, !3
         20      > JMPZ_EX                                          ~26     ~26, ->23
         21    >   IS_SMALLER                                       ~27     0, !4
         22        BOOL                                             ~26     ~27
         23    > > JMPZ_EX                                          ~26     ~26, ->26
         24    >   IS_SMALLER                                       ~28     0, !5
         25        BOOL                                             ~26     ~28
         26    > > JMPZ                                                     ~26, ->50
   10    27    >   MUL                                              ~29     !5, 12
         28        ASSIGN                                                   !6, ~29
   11    29        DIV                                              ~31     !4, 1200
         30        ASSIGN                                                   !7, ~31
   12    31        MUL                                              ~33     !3, !7
         32        INIT_FCALL                                               'pow'
         33        ADD                                              ~34     1, !7
         34        SEND_VAL                                                 ~34
         35        SEND_VAR                                                 !6
         36        DO_ICALL                                         $35     
         37        MUL                                              ~36     $35, ~33
         38        INIT_FCALL                                               'pow'
         39        ADD                                              ~37     1, !7
         40        SEND_VAL                                                 ~37
         41        SEND_VAR                                                 !6
         42        DO_ICALL                                         $38     
         43        SUB                                              ~39     $38, 1
         44        DIV                                              ~40     ~36, ~39
         45        ASSIGN                                                   !0, ~40
   13    46        MUL                                              ~42     !0, !6
         47        ASSIGN                                                   !2, ~42
   14    48        SUB                                              ~44     !2, !3
         49        ASSIGN                                                   !1, ~44
   18    50    >   ECHO                                                     '%0A%3C%21DOCTYPE+html%3E%0A%3Chtml%3E%0A%3Chead%3E%0A++%3Cmeta+charset%3D%22UTF-8%22%3E%0A++%3Ctitle%3EEMI+Calculator%3C%2Ftitle%3E%0A%3C%2Fhead%3E%0A%3Cbody+style%3D%22font-family%3A+Arial%2C+sans-serif%3B+background%3A+%23f5f5f5%3B+margin%3A+20px%3B%22%3E%0A%0A++%3Cdiv+style%3D%22max-width%3A+500px%3B+margin%3A+auto%3B+background%3A+%23fff%3B+padding%3A+25px%3B+border-radius%3A+12px%3B+box-shadow%3A+0+0+15px+rgba%280%2C0%2C0%2C0.1%29%3B%22%3E%0A++++%3Ch2+style%3D%22color%3A+%2338ad2a%3B+text-align%3A+center%3B%22%3E%F0%9F%92%B0+EMI+Calculator%3C%2Fh2%3E%0A%0A++++%3Cform+method%3D%22post%22+action%3D%22%22+style%3D%22margin-top%3A+20px%3B%22%3E%0A++++++%3Clabel+style%3D%22display%3Ablock%3B+margin-bottom%3A+10px%3B%22%3ELoan+Amount+%28%E2%82%B9%29%3A%3C%2Flabel%3E%0A++++++%3Cinput+type%3D%22number%22+name%3D%22loan%22+step%3D%220.01%22+required+style%3D%22width%3A+100%25%3B+padding%3A+10px%3B+border%3A+1px+solid+%23ccc%3B+border-radius%3A+8px%3B+margin-bottom%3A+15px%3B%22%3E%0A%0A++++++%3Clabel+style%3D%22display%3Ablock%3B+margin-bottom%3A+10px%3B%22%3EAnnual+Interest+Rate+%28%25%29%3A%3C%2Flabel%3E%0A++++++%3Cinput+type%3D%22number%22+name%3D%22rate%22+step%3D%220.01%22+required+style%3D%22width%3A+100%25%3B+padding%3A+10px%3B+border%3A+1px+solid+%23ccc%3B+border-radius%3A+8px%3B+margin-bottom%3A+15px%3B%22%3E%0A%0A++++++%3Clabel+style%3D%22display%3Ablock%3B+margin-bottom%3A+10px%3B%22%3ELoan+Term+%28Years%29%3A%3C%2Flabel%3E%0A++++++%3Cinput+type%3D%22number%22+name%3D%22years%22+required+style%3D%22width%3A+100%25%3B+padding%3A+10px%3B+border%3A+1px+solid+%23ccc%3B+border-radius%3A+8px%3B+margin-bottom%3A+20px%3B%22%3E%0A%0A++++++%3Cbutton+type%3D%22submit%22+style%3D%22width%3A+100%25%3B+background-color%3A+%2338ad2a%3B+color%3A+%23fff%3B+padding%3A+12px%3B+border%3A+none%3B+border-radius%3A+8px%3B+font-size%3A+16px%3B%22%3ECalculate+EMI%3C%2Fbutton%3E%0A++++%3C%2Fform%3E%0A%0A++++'
   43    51      > JMPZ                                                     !0, ->71
   44    52    >   ECHO                                                     '++++++%3Cdiv+style%3D%22margin-top%3A+30px%3B+border-top%3A+1px+solid+%23ccc%3B+padding-top%3A+20px%3B%22%3E%0A++++++++%3Cp+style%3D%22color%3A+black%3B+font-weight%3A+bold%3B%22%3E%F0%9F%93%85+Monthly+EMI%3A+%3Cspan+style%3D%22color%3A+green%3B%22%3E%E2%82%B9'
   45    53        INIT_FCALL                                               'number_format'
         54        SEND_VAR                                                 !0
         55        SEND_VAL                                                 2
         56        DO_ICALL                                         $46     
         57        ECHO                                                     $46
         58        ECHO                                                     '%3C%2Fspan%3E%3C%2Fp%3E%0A++++++++%3Cp+style%3D%22color%3A+black%3B+font-weight%3A+bold%3B%22%3E%F0%9F%92%B8+Total+Interest+Payable%3A+%3Cspan+style%3D%22color%3A+red%3B%22%3E%E2%82%B9'
   46    59        INIT_FCALL                                               'number_format'
         60        SEND_VAR                                                 !1
         61        SEND_VAL                                                 2
         62        DO_ICALL                                         $47     
         63        ECHO                                                     $47
         64        ECHO                                                     '%3C%2Fspan%3E%3C%2Fp%3E%0A++++++++%3Cp+style%3D%22color%3A+black%3B+font-weight%3A+bold%3B%22%3E%F0%9F%A7%BE+Total+Payment+%28Principal+%2B+Interest%29%3A+%3Cspan+style%3D%22color%3A+%2338ad2a%3B%22%3E%E2%82%B9'
   47    65        INIT_FCALL                                               'number_format'
         66        SEND_VAR                                                 !2
         67        SEND_VAL                                                 2
         68        DO_ICALL                                         $48     
         69        ECHO                                                     $48
         70        ECHO                                                     '%3C%2Fspan%3E%3C%2Fp%3E%0A++++++%3C%2Fdiv%3E%0A++++'
   50    71    >   ECHO                                                     '++%3C%2Fdiv%3E%0A%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   53    72      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
132.1 ms | 1020 KiB | 15 Q