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 - 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="profile.php">Profile<a/> - <a href="logout.php">Logout<a/> <br /> <br /> <!-- New Post Start --> <!-- New Post End --> <!-- List Forum Category Threads - Start --> <?php if (isset($_GET['fid'])) { // 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(); } $fid = $_GET['fid']; $catnamequery = mysqli_query($sqli, "SELECT * FROM forumcat WHERE id='$fid'") or die("Error: ".mysqli_error($sqli)); while ($row = mysqli_fetch_array($catnamequery)) { ?> <hr /> <a href="forum.php">Forum</a> <span class="text"> - </span> <? if (isset($_GET['tid'])) { ?> <span class="text"><a href="forum.php?fid=<?php echo $_GET['fid'] ?>"><?php echo $row['forumname'] ?></a></span> <?php } else { ?> <span class="text"><?php echo $row['forumname'] ?></span> <?php } ?> <hr /> <?php } if (isset($_GET['tid'])) { $tid = $_GET['tid']; $query = mysqli_query($sqli, "SELECT * FROM forumtopics WHERE id='$tid'") or die("Error: ".mysqli_error($sqli)); $checkthreadexists = mysqli_num_rows($query); // Check if we have any threads in this category if($checkthreadexists == 0) { // No threads ?> <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> <td>No such topic ID exists!</td> </tr> </table> </td> </tr> </table> <?php } else { $row = mysqli_fetch_array($query); $uid = $row['userid']; $userquery = mysqli_query($sqli, "SELECT * FROM members WHERE id='$uid'") or die("Error: ".mysqli_error($sqli)); $userrow = mysqli_fetch_array($userquery); ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF"> <tr> <th></th> <th></th> <th><?php echo $row['threadname'] ?></th> <th></th> </tr> <tr> <td><a href="profile.php?id=<?php echo $uid ?>" style="color: black"><?php echo $userrow['username'] ?></a></td> <td></td> <td><?php echo $row['text'] ?><hr /><?php echo $row['timestamp'] ?></td> <td></td> </tr> </table> </td> </tr> </table> <?php } //Ladda replies här under $query = mysqli_query($sqli, "SELECT * FROM forumreplies WHERE threadid='$tid'") or die("Error: ".mysqli_error($sqli)); while ($row = mysqli_fetch_array($query)) { $uid = $row['userid']; $userquery = mysqli_query($sqli, "SELECT * FROM members WHERE id='$uid'") or die("Error: ".mysqli_error($sqli)); $userrow = mysqli_fetch_array($userquery); ?> <table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <td> <table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><a href="profile.php?id=<?php echo $uid ?>" style="color: black"><?php echo $userrow['username'] ?></a></td> <td></td> <td><?php echo $row['text'] ?><hr /><?php echo $row['timestamp'] ?></td> <td></td> </tr> </table> </td> </tr> </table> <?php } } else { $fid = $_GET['fid']; $query = mysqli_query($sqli, "SELECT * FROM forumtopics WHERE categoryid='$fid' ORDER BY id") or die("Error: ".mysqli_error($sqli)); //Don't order by ID! $checknumthreads = mysqli_num_rows($query); // Check if we have any threads in this category if($checknumthreads == 0) { // No threads ?> <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> <td>No forums threads found in the database!</td> </tr> </table> </td> </tr> </table> <?php } else { ?> <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="4" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><strong>Name</strong></td> <td></td> <td><strong>Replies</strong></td> <td><strong>Last Post</strong></td> </tr> <?php while ($row = mysqli_fetch_array($query)) { ?> <tr> <td><a href="?fid=<?php echo $_GET['fid'] ?>&tid=<?php echo $row['id'] ?>" style="color: black"><?php echo $row['threadname'] ?></a></td> <td></td> <td> <?php $id = $row['id']; $replyquery = mysqli_query($sqli, "SELECT * FROM forumreplies WHERE threadid='$id'") or die("Error: ".mysqli_error($sqli)); $numreplies = mysqli_num_rows($replyquery); echo $numreplies; ?> </td> <td> <?php //Tid för Senaste Post här $lasttimepostquery = mysqli_query($sqli, "SELECT * FROM forumreplies WHERE threadid='$id' ORDER BY ASC") or die("Error: ".mysqli_error($sqli)); $numposts = mysqli_num_rows($lasttimepostquery); $lasttimestamprow = mysqli_fetch_array($query) echo $lasttimestamprow['timestamp']; ?> </td> </tr> <?php } ?> </table> </td> </tr> </table> <?php } } ?> <hr /> <a href="?fid=<?php echo $_GET['fid'] ?>&action=new">New Topic</a> <?php if (isset($_GET['tid']) && empty(!$_GET['fid'])) { ?> <span class="text"> - </span> <a href="?fid=<?php echo $_GET['fid'] ?>&action=new">New Reply</a> <?php } ?> <hr /> <!-- List Forum Category Threads - End --> <!-- List Forum Categories - Start --> <?php } 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 forumcat ORDER BY id") or die("Error: ".mysqli_error($sqli)); $checknumforums = mysqli_num_rows($query); // Check if we have any forum categories if($checknumforums == 0) { // No forums ?> <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> <td>No forums found in the database!</td> </tr> </table> </td> </tr> </table> <?php } else { ?> <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="4" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><strong>Name</strong></td> <td></td> <td><strong>Threads</strong></td> <td><strong>Last Post</strong></td> </tr> <?php while ($row = mysqli_fetch_array($query)) { ?> <tr> <td><a href="?fid=<?php echo $row['id'] ?>" style="color: black"><?php echo $row['forumname'] ?></a></td> <td></td> <td> <?php $id = $row['id']; $threadsquery = mysqli_query($sqli, "SELECT * FROM forumtopics WHERE categoryid='$id'") or die("Error: ".mysqli_error($sqli)); $numthreads = mysqli_num_rows($threadsquery); echo $numthreads; ?> </td> <td>00:00</td> </tr> <?php } ?> </table> </td> </tr> </table> <?php } } ?> <!-- List Forum Categories - 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.0130.06112.50
5.4.280.0110.05212.39
5.4.270.0100.05012.39
5.4.260.0130.05112.39
5.4.250.0090.05112.39
5.4.240.0070.06212.39
5.4.230.0100.05812.38
5.4.220.0100.03612.39
5.4.210.0060.03812.38
5.4.200.0110.05812.39
5.4.190.0110.05112.38
5.4.180.0110.06412.38
5.4.170.0110.05512.39
5.4.160.0090.05212.38
5.4.150.0060.06012.38
5.4.140.0060.05612.07
5.4.130.0100.05112.05
5.4.120.0110.05212.02
5.4.110.0070.05112.02
5.4.100.0100.04912.02
5.4.90.0150.07012.01
5.4.80.0100.06512.01
5.4.70.0080.05512.02
5.4.60.0100.05412.01
5.4.50.0100.05212.01
5.4.40.0070.05212.00
5.4.30.0060.05312.00
5.4.20.0110.06411.99
5.4.10.0100.05411.99
5.4.00.0110.06411.49
5.3.280.0090.05612.71
5.3.270.0070.06012.72
5.3.260.0070.06312.72
5.3.250.0120.05712.72
5.3.240.0140.05712.72
5.3.230.0150.11212.71
5.3.220.0180.08912.68
5.3.210.0100.07712.68
5.3.200.0130.06312.68
5.3.190.0140.05012.67
5.3.180.0090.05512.67
5.3.170.0080.05712.67
5.3.160.0110.05612.67
5.3.150.0150.05512.68
5.3.140.0070.05612.66
5.3.130.0110.05812.66
5.3.120.0090.05712.66
5.3.110.0150.06312.66
5.3.100.0100.05212.12
5.3.90.0080.06012.09
5.3.80.0130.05412.07
5.3.70.0110.06312.07
5.3.60.0050.06312.06
5.3.50.0060.05912.01
5.3.40.0080.06412.01
5.3.30.0160.05711.96
5.3.20.0090.06011.74
5.3.10.0070.05311.71
5.3.00.0060.05211.70

preferences:
150.9 ms | 1394 KiB | 7 Q