3v4l.org

run code in 300+ PHP versions simultaneously
<?php ini_set('display_errors', 'On'); error_reporting(E_ALL); $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $start = $time; define("DB_HOST","mysql117.loopia.se"); define("DB_USER","normal@i103189"); define("DB_PASS","KungMicke87"); define("DB_NAME","indiehjaerta_com"); if (isset($_POST['add'])) { //forumreplies if (isset($_POST['forumid']) && empty(!$_POST['forumid'])) { // 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(); } $saveThread = TRUE; $emptyStory = FALSE; $emptyText = FALSE; $subject = mysqli_real_escape_string($sqli, $_POST['subject']); $text = mysqli_real_escape_string($sqli, $_POST['text']); $fid = mysqli_real_escape_string($sqli, $_POST['forumid']); $query = mysqli_query($sqli,"SELECT * FROM forumcat WHERE id='$fid'") or die("Error: ".mysqli_error($sqli)); $results = mysqli_num_rows($query); if ($results == 0) { $error = "No such CategoryID."; } else { $timestamp = date('Y-m-d H:i:s'); $userid = $_SESSION['id']; if (empty($subject)) { $emptySubject = TRUE; $saveThread = FALSE; } elseif (empty($text)) { $emptyText = TRUE; $saveThread = FALSE; } if ($saveThread == TRUE) { $addquery = mysqli_query($sqli,"INSERT INTO forumtopics (`threadname`, `text`, `categoryid`, `userid`, `timestamp`) VALUES ('$subject', '$text', '$fid', '$userid', '$timestamp')"); $tid = mysqli_insert_id($addquery); header("location:forummessage.php?added=thread&fid=$fid&tid=$tid"); } } } else { echo "No ForumID set."; } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>indiehjaerta.com - Forum</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/> - <a href="logout.php">Logout<a/> <br /> <hr /> <br /> <? elseif (isset($_GET['added']) && ($_GET['added'] == 'thread')) { ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <strong>Forums</strong> </td> </tr> <tr> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Thread Created</strong></td> </tr> <tr> <td colspan="3"><a href="forum.php?fid=$_GET['fid']&tid=$_GET['tid']">Link to thread.</a></td> </tr> </table> </td> </tr> </table> <?php } elseif (isset($_GET['action']) && $_GET['action'] == 'new') { if (isset($_GET['type']) && $_GET['type'] == 'thread') { if (isset($_GET['fid']) && empty(!$_GET['fid'])) { ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <strong>Forums</strong> </td> </tr> <tr> <form method="post" action=""> <input name="forumid" type="hidden" id="forumid" value="<?php echo $_GET['fid'] ?>"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong>Create Thread</strong></td> </tr> <tr> <td colspan="3">$error</td> </tr> <tr> <td width="78"><strong>Subject</strong></td> <td width="6">:</td> <td width="294"><input name="subject" type="text" id="subject"></td> </tr> <tr> <td>Story</td> <td>:</td> <td><textarea name="text" type="text" id="text" rows="3"></textarea></td> </tr> <tr> <td>&nbsp;</td> <td>&nbsp;</td> <td><input type="submit" name="add" value="Post"></td> </tr> </table> </td> </form> </tr> </table> <?php } else { echo "Forum ID missing."; } } } else { echo "Nothing to see here."; } ?> <?php $time = microtime(); $time = explode(' ', $time); $time = $time[1] + $time[0]; $finish = $time; $total_time = round(($finish - $start), 4); echo '<span class="text">Page generated in '.$total_time.' seconds.</span><br />'; ?> </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.4.290.0000.04018.95
5.4.280.0100.03319.22
5.4.270.0030.03719.33
5.4.260.0000.04019.03
5.4.250.0130.03019.07
5.4.240.0000.04719.21
5.4.230.0070.04019.09
5.4.220.0000.05319.19
5.4.210.0000.05319.07
5.4.200.0030.04319.19
5.4.190.0030.03718.98
5.4.180.0030.03719.12
5.4.170.0000.04018.86
5.4.160.0000.04019.22
5.4.150.0030.03719.12
5.4.140.0000.04316.52
5.4.130.0030.03716.49
5.4.120.0000.03716.40
5.4.110.0000.03716.46
5.4.100.0030.04716.35
5.4.90.0000.05716.45
5.4.80.0070.04016.50
5.4.70.0030.04016.55
5.4.60.0030.05016.16
5.4.50.0000.03716.52
5.4.40.0070.03316.55
5.4.30.0000.03716.48
5.4.20.0070.05016.53
5.4.10.0030.04316.24
5.4.00.0030.03315.94
5.3.280.0030.06714.57
5.3.270.0030.04014.64
5.3.260.0000.04014.45
5.3.250.0000.07014.66
5.3.240.0030.03314.56
5.3.230.0000.03714.44
5.3.220.0070.06714.52
5.3.210.0030.04314.48
5.3.200.0000.03714.43
5.3.190.0000.03714.52
5.3.180.0070.04014.55
5.3.170.0030.06014.45
5.3.160.0030.04314.43
5.3.150.0000.04714.52
5.3.140.0000.04014.49
5.3.130.0000.04014.41
5.3.120.0000.08314.40
5.3.110.0030.06014.48
5.3.100.0000.03713.95
5.3.90.0030.03313.89
5.3.80.0000.03714.00
5.3.70.0000.03714.11
5.3.60.0000.03714.05
5.3.50.0000.03713.75
5.3.40.0000.04714.04
5.3.30.0030.04013.75
5.3.20.0000.04313.49
5.3.10.0070.02713.61
5.3.00.0000.03713.73
5.2.170.0070.05711.16
5.2.160.0100.04711.01
5.2.150.0000.05011.01
5.2.140.0030.02711.19
5.2.130.0000.03711.02
5.2.120.0000.05011.22
5.2.110.0000.03310.99
5.2.100.0030.02710.95
5.2.90.0000.05711.16
5.2.80.0000.03710.95
5.2.70.0100.02311.12
5.2.60.0000.03011.10
5.2.50.0000.03010.88
5.2.40.0000.03710.86
5.2.30.0030.02710.81
5.2.20.0030.03310.98
5.2.10.0030.02710.77
5.2.00.0000.03010.67
5.1.60.0000.0339.98
5.1.50.0000.0279.98
5.1.40.0030.0239.98
5.1.30.0030.03010.26
5.1.20.0000.03010.47
5.1.10.0000.0379.98
5.1.00.0000.03310.05
5.0.50.0000.0239.98
5.0.40.0030.0209.98
5.0.30.0000.0339.98
5.0.20.0000.0209.98
5.0.10.0000.0209.98
5.0.00.0000.0409.98
4.4.90.0000.0139.98
4.4.80.0000.0139.98
4.4.70.0000.0179.98
4.4.60.0000.0339.98
4.4.50.0000.0209.98
4.4.40.0000.0239.98
4.4.30.0000.0179.98
4.4.20.0000.0139.98
4.4.10.0000.0179.98
4.4.00.0000.0279.98
4.3.110.0000.0179.98
4.3.100.0000.0209.98
4.3.90.0000.0139.98
4.3.80.0000.0509.98
4.3.70.0030.0209.98
4.3.60.0000.0239.98
4.3.50.0000.0209.98
4.3.40.0000.0239.98
4.3.30.0000.0179.98
4.3.20.0030.0139.98
4.3.10.0030.0279.98
4.3.00.0070.0109.98

preferences:
135.65 ms | 1394 KiB | 7 Q