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"); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>indiehjaerta.com - News</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="profile.php">Profile<a/> - <a href="logout.php">Logout<a/> <br /> <br /> <!-- New Post Start --> <?php if (isset($_GET['id'])) { // 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(); } $id = $_GET['id']; $query = mysqli_query($sqli, "SELECT * FROM news WHERE id='$id'") or die("Error: ".mysqli_error($sqli)); $checknumnews = mysqli_num_rows($query); // Check if news exists if($checknumnews == 0) { // No News echo '<span class="text">No News found matching ID!</span><br />'; } else { while ($row = mysqli_fetch_array($query)) { $id = $row['id']; ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <strong>News</strong> </td> </tr> <tr> <td> <?php //Number of characters to show $chars = 25; while ($row = mysqli_fetch_array($query)) { $id = $row['id']; $story = $row['story']; ?> <table width="100%" border="0" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><strong>Subject:</strong></td> <td><strong><?php echo $row['headline'] ?></strong></td> </tr> <tr> <td colspan="2"><strong>Story:</strong></td> </tr> <tr> <td colspan="2"><?php echo $story ?></td> </tr> <?php $userid = $row['userid']; $query2 = mysqli_query($sqli, "SELECT * FROM members WHERE id='$userid'") or die("Error: ".mysqli_error($sqli)); while ($row2 = mysqli_fetch_array($query2)) { ?> <tr> <td><strong>Written by:</strong></td> <td><a href="profile.php?id=<?php echo $userid ?>" style="color: black;"><?php echo $row2['username'] ?></a></td> </tr> <?php } ?> <tr> <td><strong>Time:</strong></td> <td><?php echo $row['timestamp'] ?></td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> </table> <?php /* echo '<table border="0">'; echo '<tr>'; echo '<td><span class="text">Subject:</span></td>'; echo '<td><span class="text">' .$row['headline']. '</span></td>'; echo '</tr>'; $story = $row['story']; echo '<tr>'; echo '<td colspan="2"><span class="text">Story:</span></td>'; echo '</tr>'; echo '<tr>'; echo '<td colspan="2"><span class="text">' .$story. '</span></td>'; echo '</tr>'; $userid = $row['userid']; $query2 = mysqli_query($sqli, "SELECT * FROM members WHERE id='$userid'") or die("Error: ".mysqli_error($sqli)); while ($row2 = mysqli_fetch_array($query2)) { echo '<tr>'; echo '<td><span class="text">Written by:</span></td>'; echo '<td><span class="text"><a href="profile.php?id=' .$userid.' ">' .$row2['username']. '</a></span></td>'; echo '</tr>'; } echo '<tr>'; echo '<td><span class="text">Time:</span></td>'; echo '<td><span class="text">' .$row['timestamp']. '</span></td>'; echo '</tr>'; echo "</table><br />"; */ } } } else { // 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 news ORDER BY id") or die("Error: ".mysqli_error($sqli)); $checknumnews = mysqli_num_rows($query); // Check if user exists if($checknumnews == 0) { // No News echo '<span class="text">No News found in the database!</span><br />'; } else { ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <strong>News</strong> </td> </tr> <tr> <td> <?php //Number of characters to show $chars = 25; while ($row = mysqli_fetch_array($query)) { $id = $row['id']; ?> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td colspan="3"><strong><a href="?id=<?php echo $id ?>" style="color: black;"><?php echo $row['headline'] ?></a></strong></td> </tr> <tr> <?php $story = $row['story']; if (strlen($story) >= $chars) { $story = substr($story,0,$chars); $story = substr($story,0,strrpos($story,' ')); $story = $story."... <a href='?id=$id' style='color: black;'>(Read more)</a>"; } ?> <td colspan="3"><?php echo $story ?></td> </tr> <?php $userid = $row['userid']; $query2 = mysqli_query($sqli, "SELECT * FROM members WHERE id='$userid'") or die("Error: ".mysqli_error($sqli)); while ($row2 = mysqli_fetch_array($query2)) { echo '<tr>'; echo '<td><strong>Written by:<strong></td>'; echo '<td><a href="profile.php?id=' .$userid.' " style="color: black;">' .$row2['username']. '</a></td>'; echo '</tr>'; } ?> <tr> <td><strong>Time:</strong></td> <td><?php echo $row['timestamp'] ?></td> </tr> </table> </td> </tr> <tr> <td> <?php } ?> </td> </tr> </table> <?php } } ?> <!-- New Post End --> <?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.0370.05719.32
5.4.280.0270.04019.08
5.4.270.0130.04319.18
5.4.260.0270.05018.86
5.4.250.0200.04319.15
5.4.240.0300.07019.21
5.4.230.0300.04318.97
5.4.220.0300.04019.05
5.4.210.0230.06019.21
5.4.200.0270.04319.12
5.4.190.0230.07319.20
5.4.180.0200.07719.14
5.4.170.0300.07019.14
5.4.160.0230.07319.13
5.4.150.0130.04318.95
5.4.140.0230.07016.51
5.4.130.0300.06316.50
5.4.120.0270.07016.46
5.4.110.0200.03316.35
5.4.100.0270.06316.34
5.4.90.0170.04716.45
5.4.80.0300.04016.53
5.4.70.0300.05016.35
5.4.60.0200.07016.34
5.4.50.0370.03016.26
5.4.40.0230.05716.56
5.4.30.0100.04716.25
5.4.20.0170.07716.22
5.4.10.0200.04316.55
5.4.00.0200.06716.02
5.3.280.0230.07714.45
5.3.270.0200.04014.71
5.3.260.0200.04014.53
5.3.250.0170.06014.65
5.3.240.0200.07714.71
5.3.230.0300.06314.46
5.3.220.0300.06014.52
5.3.210.0230.06714.54
5.3.200.0270.05014.56
5.3.190.0170.07714.54
5.3.180.0230.05014.53
5.3.170.0170.06714.45
5.3.160.0170.07314.45
5.3.150.0330.03714.46
5.3.140.0230.05714.45
5.3.130.0170.04014.61
5.3.120.0100.06014.45
5.3.110.0170.05014.55
5.3.100.0170.07314.45
5.3.90.0170.03714.45
5.3.80.0170.05314.45
5.3.70.0100.04014.45
5.3.60.0170.03314.45
5.3.50.0230.07014.45
5.3.40.0270.06714.45
5.3.30.0200.07014.45
5.3.20.0200.07014.45
5.3.10.0270.06714.45
5.3.00.0200.07714.45

preferences:
149.91 ms | 1398 KiB | 7 Q