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.0090.05612.48
5.4.280.0080.05612.38
5.4.270.0050.05712.38
5.4.260.0100.05212.38
5.4.250.0040.05612.38
5.4.240.0080.06612.38
5.4.230.0070.05512.37
5.4.220.0090.04412.37
5.4.210.0050.05412.37
5.4.200.0060.03912.37
5.4.190.0060.03612.36
5.4.180.0050.04512.37
5.4.170.0070.05312.38
5.4.160.0060.05012.37
5.4.150.0110.04612.37
5.4.140.0090.05012.06
5.4.130.0060.03612.04
5.4.120.0090.04612.00
5.4.110.0060.03612.00
5.4.100.0060.03512.00
5.4.90.0080.03512.00
5.4.80.0090.03412.00
5.4.70.0090.03111.99
5.4.60.0080.03211.99
5.4.50.0070.03511.99
5.4.40.0060.03511.98
5.4.30.0080.03611.98
5.4.20.0080.04411.97
5.4.10.0070.03411.98
5.4.00.0070.03611.47
5.3.280.0040.04012.71
5.3.270.0070.03912.72
5.3.260.0100.04512.72
5.3.250.0060.04612.72
5.3.240.0090.03812.72
5.3.230.0100.04512.71
5.3.220.0070.03612.68
5.3.210.0070.03812.68
5.3.200.0060.03712.68
5.3.190.0060.03712.68
5.3.180.0040.04112.68
5.3.170.0060.03712.66
5.3.160.0060.03712.67
5.3.150.0130.04712.67
5.3.140.0050.04512.66
5.3.130.0050.04112.66
5.3.120.0020.04312.66
5.3.110.0060.03912.66
5.3.100.0070.05012.12
5.3.90.0090.04212.08
5.3.80.0070.03712.08
5.3.70.0080.03512.07
5.3.60.0060.03612.07
5.3.50.0030.04012.00
5.3.40.0050.04212.00
5.3.30.0030.03911.95
5.3.20.0030.03811.73
5.3.10.0020.04511.70
5.3.00.0080.03411.68

preferences:
131.15 ms | 939 KiB | 8 Q