3v4l.org

run code in 300+ PHP versions simultaneously
<?php function random_password( $length = 8 ) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?"; $password = substr( str_shuffle( $chars ), 0, $length ); return $password; } $error = ""; if (isset($_GET["token"]) && preg_match('/^[0-9A-F]{40}$/i', $_GET["token"])) { $token = $_GET["token"]; define("DB_HOST","mysql117.loopia.se"); define("DB_USER","normal@i103189"); define("DB_PASS","KungMicke87"); define("DB_NAME","indiehjaerta_com"); // Connect to MySQLi $sqli = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME) or die("Error: ".mysqli_error($sqli)); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $query = mysqli_query($sqli, "SELECT * FROM passwordrequest WHERE token='$token'") or die("Error: ".mysqli_error($sqli)); $results = mysqli_num_rows($query); if ($results == 0) { $error = "Error invalid token."; } else { $row = mysqli_fetch_array($query); $email = $row['email']; $timestamp = $row['timestamp']; $url = "http://www.indihjaerta.com/login.php"; //Generate Password Here -- FIXA!!!!!!!!! $password = random_password(8); echo $password; //Has Password Here $hashedpassword = password_hash($password, PASSWORD_BCRYPT, ['cost' => 12]); //Update new password in table $updatequery = mysqli_query($sqli,"UPDATE members SET password = '$hashedpassword' WHERE email='$email'"); //$message = "Press think link $url to reset your password.\n\n If you didn't request a password change please discard this e-mail."; $message = "This function is currently not working :(. But it should be a password here." $headers = 'From: [indiehjaerta.com] Admin <no-reply@indiehjaerta.com>' . "\r\n"; mail($email, "[indiehjaerta.com] New Password", $message, $headers); //Delete post to make link invalid $deletequery = mysqli_query($sqli, "DELETE * FROM passwordrequest WHERE token='$token' AND email='$email' AND timestamp='$timestamp'") or die("Error: ".mysqli_error($sqli)); } } else { $error = "No token." } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>indiehjaerta.com</title> <link href="style_test.css" rel="stylesheet" type="text/css" /> </head> <body> <a href="login.php">Login<a/> - <a href="admin.php">Admin<a/> - <a href="members.php">Members<a/> - <a href="register.php">Register<a/> - <a href="blog.php">Blog<a/> - <a href="news.php">News<a/> - <a href="event.php">Event<a/> - <a href="forum.php">Forum<a/> <br /> <br /> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <?php if (!empty($error)) { ?> <td colspan="3"><strong><?php echo $error ?></strong></td> <?php } else { ?> <td colspan="3"><strong>Not implemented. <!-- An e-mail containing your new password has been sent to e-mail . --></strong></td> <?php } ?> </tr> </table> </td> </tr> </table> </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)
5.6.100.0000.04321.03
5.6.90.0100.08321.05
5.6.80.0200.05320.56
5.5.260.0170.07020.78
5.5.250.0100.07320.68
5.5.240.0070.07720.27
5.4.430.0200.05719.63
5.4.420.0130.08019.52
5.4.410.0270.05319.32
5.4.400.0200.03719.13
5.4.390.0200.07018.84
5.4.380.0130.05719.06
5.4.370.0230.04019.11
5.4.360.0300.04019.24
5.4.350.0170.08319.21
5.4.340.0170.05719.13
5.4.320.0200.06719.00
5.4.310.0270.06718.98
5.4.300.0370.03719.12
5.4.290.0300.06019.05
5.4.280.0200.05019.08
5.4.270.0200.08318.92
5.4.260.0230.07319.20
5.4.250.0230.03319.16
5.4.240.0130.05019.07
5.4.230.0230.04719.04
5.4.220.0230.06018.94
5.4.210.0200.04018.97
5.4.200.0170.04719.20
5.4.190.0200.08318.83
5.4.180.0270.04319.13
5.4.170.0230.04319.12
5.4.160.0200.04718.96
5.4.150.0270.04318.93
5.4.140.0200.07716.38
5.4.130.0370.02716.39
5.4.120.0300.04716.33
5.4.110.0270.07316.46
5.4.100.0230.07016.27
5.4.90.0200.07016.46
5.4.80.0200.04016.55
5.4.70.0230.06716.50
5.4.60.0170.07016.47
5.4.50.0300.05316.33
5.4.40.0270.06716.54
5.4.30.0270.06016.24
5.4.20.0230.04316.43
5.4.10.0370.03016.27
5.4.00.0170.04715.80
5.3.290.0230.07314.61
5.3.280.0270.07014.49
5.3.270.0370.06014.60
5.3.260.0330.05714.74
5.3.250.0300.06714.53
5.3.240.0200.07314.55
5.3.230.0230.06714.63
5.3.220.0270.07014.61
5.3.210.0170.05014.67
5.3.200.0230.04014.59
5.3.190.0300.06314.50
5.3.180.0230.03314.70
5.3.170.0330.06014.55
5.3.160.0230.05014.66
5.3.150.0330.04014.59
5.3.140.0270.05714.59
5.3.130.0300.05714.49
5.3.120.0200.04014.62
5.3.110.0230.05314.49
5.3.100.0200.04314.49
5.3.90.0200.07014.49
5.3.80.0270.05314.49
5.3.70.0270.04714.49
5.3.60.0230.06314.49
5.3.50.0230.05714.49
5.3.40.0370.05714.49
5.3.30.0200.07014.49
5.3.20.0270.06014.49
5.3.10.0170.07714.49
5.3.00.0230.04314.49

preferences:
141.4 ms | 1386 KiB | 7 Q