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>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.5.10.0040.00516.88
8.5.00.0140.00820.25
8.4.150.0020.00014.05
8.4.140.0150.00617.70
8.4.130.0100.00818.05
8.4.120.0040.00520.62
8.4.110.0110.00918.72
8.4.100.0440.00717.92
8.4.90.0410.00518.18
8.4.80.0370.01117.67
8.4.70.0320.01417.77
8.4.60.0410.01117.73
8.4.50.0330.01117.53
8.4.40.0260.00617.46
8.4.30.0240.00217.34
8.4.20.0130.00517.61
8.4.10.0160.00417.57
8.3.280.0100.01018.64
8.3.270.0150.00616.91
8.3.260.0070.00616.97
8.3.250.0050.00417.21
8.3.240.0080.01017.31
8.3.230.0110.00616.54
8.3.220.0120.00416.05
8.3.210.0110.00516.30
8.3.200.0140.00316.07
8.3.190.0110.00516.52
8.3.180.0110.00416.44
8.3.170.0180.00216.48
8.3.160.0130.00416.45
8.3.150.0120.00516.58
8.3.140.0110.00716.75
8.3.130.0120.00516.45
8.3.120.0110.00616.42
8.3.110.0060.00616.21
8.3.100.0140.00516.23
8.3.90.0150.00516.52
8.3.80.0130.00416.80
8.3.70.0120.00616.77
8.3.60.0130.00416.41
8.3.50.0140.00416.50
8.3.40.0150.00217.18
8.3.30.0080.00817.21
8.3.20.0100.00617.15
8.3.10.0090.00617.52
8.3.00.0120.00217.04
8.2.290.0100.00516.28
8.2.280.0130.00216.86
8.2.270.0150.00216.64
8.2.260.0090.00716.22
8.2.250.0110.00516.41
8.2.240.0110.00416.49
8.2.230.0130.00316.11
8.2.220.0100.00616.56
8.2.210.0120.00316.55
8.2.200.0100.00516.35
8.2.190.0150.00216.03
8.2.180.0150.00316.03
8.2.170.0130.00517.30
8.2.160.0150.00217.23
8.2.150.0150.00117.30
8.2.140.0110.00517.39
8.2.130.0150.00317.45
8.2.120.0140.00417.37
8.2.110.0130.00617.32
8.2.100.0130.00317.64
8.2.90.0180.00617.38
8.2.80.0110.00617.36
8.2.70.0160.00617.31
8.2.60.0120.00317.70
8.2.50.0160.00517.14
8.2.40.0140.01217.71
8.2.30.0130.00217.80
8.2.20.0200.00817.27
8.2.10.0110.00517.05
8.2.00.0160.00917.38

preferences:
32.05 ms | 403 KiB | 5 Q